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

Lighthouse-ci failing to connect to chrome on Node 18

Open agnelrdx opened this issue 6 months ago • 1 comments

Describe the bug I am running Lighthouse-ci on my Jenkins as part of my PR pipeline. I recently upgraded my project to use Node 18. Since then, Lighthouse-ci is failing to connect to Chrome. If I revert back to Node 16, it works fine. Below is the error message I'm getting.

✅  .lighthouseci/ directory writable
✅  Configuration file found
✅  Chrome installation found
⚠️   GitHub token not set
⚠️   Ancestor hash not determinable

    ERROR: Unable to determine current branch with `git rev-parse --abbrev-ref HEAD`. This can be overridden with setting LHCI_BUILD_CONTEXT__CURRENT_BRANCH env.

✅  LHCI server reachable
⚠️   LHCI server not API-compatible
✅  LHCI server token valid
⚠️   LHCI server already has a build for this commit hash

    ERROR: Unable to determine current branch with `git rev-parse --abbrev-ref HEAD`. This can be overridden with setting LHCI_BUILD_CONTEXT__CURRENT_BRANCH env.

Healthcheck passed!

Running Lighthouse 3 time(s) on https://baseplates-ci.uap.int.api.bbci.co.uk/cbeebies-app-vanilla/88a18519eeff71877d24155aeb13503fc451fedd/

Run #1...failed!

Error: Lighthouse failed with exit code 1
    at ChildProcess.<anonymous> (/var/lib/jenkins/workspace/UAP/test/node_modules/@lhci/cli/src/collect/node-runner.js:120:21)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)

Sat, 23 Dec 2023 19:26:28 GMT LH:ChromeLauncher Waiting for browser.
Sat, 23 Dec 2023 19:26:28 GMT LH:ChromeLauncher Waiting for browser...
Sat, 23 Dec 2023 19:26:29 GMT LH:ChromeLauncher Waiting for browser.....
Sat, 23 Dec 2023 19:26:29 GMT LH:ChromeLauncher Waiting for browser.......
Sat, 23 Dec 2023 19:26:30 GMT LH:ChromeLauncher Waiting for browser.........
Sat, 23 Dec 2023 19:26:30 GMT LH:ChromeLauncher Waiting for browser...........
Sat, 23 Dec 2023 19:26:31 GMT LH:ChromeLauncher Waiting for browser.............
Sat, 23 Dec 2023 19:26:31 GMT LH:ChromeLauncher Waiting for browser...............
Sat, 23 Dec 2023 19:26:32 GMT LH:ChromeLauncher Waiting for browser.................
Sat, 23 Dec 2023 19:26:32 GMT LH:ChromeLauncher Waiting for browser...................
Sat, 23 Dec 2023 19:26:33 GMT LH:ChromeLauncher Waiting for browser.....................
Sat, 23 Dec 2023 19:26:33 GMT LH:ChromeLauncher Waiting for browser.......................
Sat, 23 Dec 2023 19:26:34 GMT LH:ChromeLauncher Waiting for browser.........................
Sat, 23 Dec 2023 19:26:34 GMT LH:ChromeLauncher Waiting for browser...........................
Sat, 23 Dec 2023 19:26:35 GMT LH:ChromeLauncher Waiting for browser.............................
Sat, 23 Dec 2023 19:26:35 GMT LH:ChromeLauncher Waiting for browser...............................
Sat, 23 Dec 2023 19:26:36 GMT LH:ChromeLauncher Waiting for browser.................................
Sat, 23 Dec 2023 19:26:36 GMT LH:ChromeLauncher Waiting for browser...................................
Sat, 23 Dec 2023 19:26:37 GMT LH:ChromeLauncher Waiting for browser.....................................
Sat, 23 Dec 2023 19:26:37 GMT LH:ChromeLauncher Waiting for browser.......................................
Sat, 23 Dec 2023 19:26:38 GMT LH:ChromeLauncher Waiting for browser.........................................
Sat, 23 Dec 2023 19:26:38 GMT LH:ChromeLauncher Waiting for browser...........................................
Sat, 23 Dec 2023 19:26:39 GMT LH:ChromeLauncher Waiting for browser.............................................
...
Sat, 23 Dec 2023 19:26:53 GMT LH:ChromeLauncher:error connect ECONNREFUSED 127.0.0.1:46079
Sat, 23 Dec 2023 19:26:53 GMT LH:ChromeLauncher:error Logging contents of /tmp/lighthouse.YfBYR4y/chrome-err.log
Sat, 23 Dec 2023 19:26:53 GMT LH:ChromeLauncher:error [47615:47615:1223/192628.748811:ERROR:ozone_platform_x11.cc(239)] Missing X server or $DISPLAY
[47615:47615:1223/192628.748839:ERROR:env.cc(257)] The platform failed to initialize.  Exiting.
Unable to connect to Chrome

Below is my pipeline script

stage("lighthouse") {
      steps {
          sh "export LHCI_AUTH_PASS = ..."
          sh "export LHCI_TOKEN = ..."
          sh "export CHROME_PATH=\$(which google-chrome-stable)"
          sh "export LHCI_BUILD_CONTEXT__EXTERNAL_BUILD_URL=\$BUILD_URL"
          sh "node ./node_modules/@lhci/cli/src/cli.js autorun"
      }
      post {
          failure {
              script {
                  FAILURE_REASON = "lighthouse :lighthouse: checks failed"
              }
          }
      }
 }

Link to my rc file: lighthouserc.js

To Reproduce Steps to reproduce the behavior:

  1. Install the latest version of @lhci
  2. Run the checks on Jenkins
  3. Observe the error.

Expected behavior The lighthouse-ci should connect to chrome and run the checks.

Environment (please complete the following information):

  • OS: CentOS 8
  • Google chrome stable
  • @lhci 0.13.0
  • Node 18

agnelrdx avatar Dec 26 '23 18:12 agnelrdx

Same here. Any solution?

ydhnwb avatar Apr 30 '24 11:04 ydhnwb