alixaxel / chrome-aws-lambda

Chromium Binary for AWS Lambda and Google Cloud Functions
MIT License
3.2k stars 292 forks source link

browser.close is not a function #225

Closed barotrahulh123 closed 10 months ago

barotrahulh123 commented 3 years ago

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(); }