Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Jul 8, 2024 · 1 comment

Comments

@rajeshchinnam
Copy link

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]
@jacobbundren
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants