GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.41k stars 644 forks source link

When running lighhouse on ec2 I am getting error TypeError: Failed to fetch browser webSocket URL from http://127.0.0.1:45185/json/version: globalThis.fetch is not a function #1055

Open rajeshchinnam opened 2 months ago

rajeshchinnam commented 2 months ago

Describe the bug Getting error on running lighthouse on my Ec2 TypeError: Failed to fetch browser webSocket URL from http://127.0.0.1:45185/json/version: globalThis.fetch is not a function

To Reproduce Steps to reproduce the behavior:

  1. Go to EC2

  2. Installed versions of npm 8.19.4 and node 16.20.2 and lighhouse 12.1.0

  3. run command sudo lighthouse https://google.com --quiet --chrome-flags="--no-sandbox --headless" --output-path=/opt/lighthouse/report.json --output json

  4. See error Runtime error encountered: Failed to fetch browser webSocket URL from http://127.0.0.1:35681/json/version: globalThis.fetch is not a function TypeError: Failed to fetch browser webSocket URL from http://127.0.0.1:35681/json/version: globalThis.fetch is not a function at getWSEndpoint (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js:67:41) at getConnectionTransport (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js:54:37) at _connectToBrowser (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js:24:56) at PuppeteerNode.connect (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js:93:16) at PuppeteerNode.connect (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/node/PuppeteerNode.js:88:22) at gatherFn (file:///usr/lib/node_modules/lighthouse/core/gather/navigation-runner.js:283:35) at Function.gather (file:///usr/lib/node_modules/lighthouse/core/runner.js:210:31) at navigationGather (file:///usr/lib/node_modules/lighthouse/core/gather/navigation-runner.js:306:34) at async navigation (file:///usr/lib/node_modules/lighthouse/core/index.js:58:24) at async runLighthouse (file:///usr/lib/node_modules/lighthouse/cli/run.js:210:26)

Expected behavior I want ighthouse report generated

Logs/Screenshots Runtime error encountered: Failed to fetch browser webSocket URL from http://127.0.0.1:35681/json/version: globalThis.fetch is not a function TypeError: Failed to fetch browser webSocket URL from http://127.0.0.1:35681/json/version: globalThis.fetch is not a function at getWSEndpoint (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js:67:41) at getConnectionTransport (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js:54:37) at _connectToBrowser (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js:24:56) at PuppeteerNode.connect (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js:93:16) at PuppeteerNode.connect (file:///usr/lib/node_modules/lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/node/PuppeteerNode.js:88:22) at gatherFn (file:///usr/lib/node_modules/lighthouse/core/gather/navigation-runner.js:283:35) at Function.gather (file:///usr/lib/node_modules/lighthouse/core/runner.js:210:31) at navigationGather (file:///usr/lib/node_modules/lighthouse/core/gather/navigation-runner.js:306:34) at async navigation (file:///usr/lib/node_modules/lighthouse/core/index.js:58:24) at async runLighthouse (file:///usr/lib/node_modules/lighthouse/cli/run.js:210:26)

Environment (please complete the following information):

jacobbundren commented 2 months ago

I am seeing this same behavior using the same environment listed above. I was trying to get a simple test running and used the official documentation found here

Any update on the issue?