chrome-aws-lambda icon indicating copy to clipboard operation
chrome-aws-lambda copied to clipboard

browser.close is not a function

Open barotrahulh123 opened this issue 3 years ago • 0 comments

browser.close is not a function errror while use chrome.puppeteer i have also try by install puppeter-core

ref : https://www.npmjs.com/package/chrome-aws-lambda --------------------------------------code--------------- const chrome = require("chrome-aws-lambda"); const lighthouse = require("lighthouse");

let generate_report = async (data) => { console.log(mobileDesktopConfig); browser = await chrome.puppeteer.launch({ executablePath: await chrome.executablePath, args: chrome.args, });

const lighthousePort = new URL(browser.wsEndpoint()).port; const options = { port: lighthousePort, extends: "lighthouse:default", maxWaitForLoad: 30 * 10000, category: ["PERFORMANCE", "ACCESSIBILITY", "BEST_PRACTICES", "SEO"], ...mobileDesktopConfig, }; const outputJsonOptions = { ...options, output: "json" }; const outputHtmlOptions = { ...options, output: "html" }; console.log("sending Request now");

const runnerResultJson = await lighthouse(url, outputJsonOptions); console.log("got json", typeof runnerResultJson); const runnerResultHtml = await lighthouse(url, outputHtmlOptions); console.log("got html", typeof runnerResultHtml);

await browser.close(); }

barotrahulh123 avatar Jun 22 '21 07:06 barotrahulh123