lighthouse-ci icon indicating copy to clipboard operation
lighthouse-ci copied to clipboard

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

Open rajeshchinnam opened this issue 1 year ago • 2 comments

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):

  • OS: Amazon Linux CentOS
  • Browser Chrome
  • Version [Google Chrome 115.0.5790.102]

rajeshchinnam avatar Jul 08 '24 07:07 rajeshchinnam

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?

0xSk3ttch avatar Jul 26 '24 03:07 0xSk3ttch

I have the same issue

maelp avatar Apr 21 '25 17:04 maelp