diff --git a/plugins/screenshot/helpers.js b/plugins/screenshot/helpers.js index 3f40cfa..b87fc0a 100644 --- a/plugins/screenshot/helpers.js +++ b/plugins/screenshot/helpers.js @@ -149,9 +149,12 @@ async function getFinishedPage( }); const scriptContent = await getConcatenatedAssets(scripts, userAgent); - await page.mainFrame().addScriptTag({ - content: scriptContent, - }); + + if(scriptContent) { + await page.mainFrame().addScriptTag({ + content: scriptContent, + }); + } // wait for the next idle callback (to have most probably finished all work) await page.evaluate(`() => { diff --git a/plugins/screenshot/routes.js b/plugins/screenshot/routes.js index cfe6310..12e9398 100644 --- a/plugins/screenshot/routes.js +++ b/plugins/screenshot/routes.js @@ -80,7 +80,7 @@ async function getScreenshotResponse(server, h, params, item) { const renderingInfo = JSON.parse(response.payload); - if (typeof renderingInfo === "object" && !!renderingInfo.scripts.content) { + if (typeof renderingInfo === "object") { throw new Boom.Boom( `Failed to get valid renderingInfo content in headless chrome for screenshot for ${item.tool} and ${params.target} with the error: ${response.statusMessage}`, {