cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Cypress is having trouble establishing a connection to the Chrome browser during my CI

Open sarah-vendredi opened this issue 1 year ago • 51 comments

Current behavior

I've had this cypress error for 4 days from the CI. The problem is that I haven't touched anything and I don't understand what's happened. If so, when do you expect to fix it?

Timed out waiting for the browser to connect. Retrying...
Still waiting to connect to Chrome, retrying in 1 second (attempt 18/62)
Still waiting to connect to Chrome, retrying in 1 second (attempt 19/62)
Still waiting to connect to Chrome, retrying in 1 second (attempt 20/62)
Still waiting to connect to Chrome, retrying in 1 second (attempt 21/62)
Still waiting to connect to Chrome, retrying in 1 second (attempt 22/62)
Still waiting to connect to Chrome, retrying in 1 second (attempt 23/62)
Still waiting to connect to Chrome, retrying in 1 second (attempt 24/62)
Still waiting to connect to Chrome, retrying in 1 second (attempt 18/62)
....

Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds.

This usually indicates there was a problem opening the Chrome browser.

Desired behavior

No response

Test code to reproduce

i cant reproduce, its on the CI

Cypress Version

12.12.0

Node version

v.16.20.1

Operating System

macOs 13.1

Debug Logs

No response

Other

No response

sarah-vendredi avatar Sep 27 '23 07:09 sarah-vendredi

@sarah-vendredi

  • From your problem description it seems very likely that you have been hit by a bug in Chrome 117 although you haven't said which version of Chrome you are using.

  • Your simplest solution may be to update Cypress to version 12.15.0 or higher. The pinned issue https://github.com/cypress-io/cypress/issues/27804 describes other workarounds.

  • The Chromium team have fixed the issue and the fix is in the process of being rolled out to Chrome. We don't have a date from them about availability in a stable release, however we know that releases regularly work on weekly schedules, so if for instance you are using Chrome provided in a default GitHub action runner it might take about three weeks for a full rollout to complete (no guarantee here!) from beta release to stable release to release in GitHub.

  • Also note that Node.js 16 reached its end-of-life on Sep 11, 2023, so you should plan on updating to Node.js 18 or 20. (This doesn't affect the Chrome issue.)

MikeMcC399 avatar Sep 27 '23 12:09 MikeMcC399

Same problem for my company. This happen in pipeline with jenkins but also in my localhost. This happen also in a production env (we did not touch code since 3 days)

multivoltage avatar Sep 27 '23 14:09 multivoltage

@multivoltage

Same problem for my company. This happen in pipeline with jenkins but also in my localhost. This happen also in a production env (we did not touch code since 3 days)

It is common for the Chrome version on a localhost to automatically update. It is also common for CI environments to automatically update the version of Chrome. In some CI systems you are able to use a Docker container to fix the version of Chrome used.

MikeMcC399 avatar Sep 27 '23 14:09 MikeMcC399

@MikeMcC399 Cool. I used docker in different project for specific chrome versione. Solve some problem but create others one :)

multivoltage avatar Sep 27 '23 14:09 multivoltage

@sarah-vendredi

Are you still having this issue?

Is yes, could you please say which version of Chrome you are using? For example from executing the command

npx cypress info

the output contains something like this:

Displaying Cypress info...

Detected 5 browsers installed:

1. Chrome
  - Name: chrome
  - Channel: stable
  - Version: 117.0.5938.150

What is the name of your CI provider.

MikeMcC399 avatar Oct 06 '23 17:10 MikeMcC399

I also have this problem :( Chrome: 119.0.6045.124 cypress: 13.5.0

veceslavsv avatar Nov 13 '23 07:11 veceslavsv

I am facing this issue when using latest cypress version with Cypress Browsers docker image (cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1)

if i revert back to cypress old version 12.4.0, then this issue is not observed, but then it blocks me to use replay functionality

magarwal19 avatar Nov 14 '23 13:11 magarwal19

I can confirm this issue.

  • Image: public.ecr.aws/cypress-io/cypress/base:20.9.0
  • Cypress: 13.6.0
  • Browser: Electron 114 (headless)
  • Node Version: v20.9.0 (/usr/local/bin/node)

Running: login/login.cy.ts (1 of 9) Timed out waiting for the browser to connect. Retrying... Cannot read properties of null (reading 'getWebSocketDebuggerUrl') TypeError: Cannot read properties of null (reading 'getWebSocketDebuggerUrl') at Object.open (:4454:111131) at async Object.open (:4460:27335) at async v.relaunchBrowser (:4526:36933)

danielbayerlein avatar Nov 22 '23 09:11 danielbayerlein

@danielbayerlein

You seem to have a different issue, given that the original post concerned Chrome and you write:

Browser: Electron 114 (headless)

MikeMcC399 avatar Nov 22 '23 10:11 MikeMcC399

Having this issue with Chrome AND Firefox. Upgraded Cypress to 13.6. Chrome is 119.0.6045.200. Firefox is 115.5.0. Both will throw a browser window that says it's being controlled, but no spec list appears, and the tests don't run

cxh324 avatar Nov 30 '23 22:11 cxh324

Also suffering from this issue for multiple weeks. Docker-container: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1 Cypress: 12.17.4 Browser used: Chrome (headless)

Jenkins manages to run cypress tests like once every 15th time, otherwise timed out connecting to Chrome.

Downgrading to Cypress version 12.4.0 seems to have solved the issue.

For some reason Chrome still stalls for 4 minutes and 50 seconds on Jenkins every time when starting tests without no apparent reasons.

terohuomo avatar Dec 01 '23 11:12 terohuomo

@cypress-app-bot @jennifer-shehane Can you please help to assign this issue..

seems some changes after 12.4.0 are causing this

magarwal19 avatar Dec 05 '23 07:12 magarwal19

have the same issue on cypress starting from v 12.5.0 Does anyone have solutions or an investigation result of the root cause?

kolomietsan avatar Dec 28 '23 13:12 kolomietsan

I see a similar issue with v13.2.0, when running in Jenkins (Red Hat 7 host) it will normally hang on Timed out waiting for the browser to connect. Retrying.... I've only seen it succeed a few times.

EM-Creations avatar Jan 17 '24 17:01 EM-Creations

My company is having the same issue while running Cypress locally with UI. The issue seems to start with Chrome 120. Cypress version: 12.17.4 and 13.6.2 Chrome version: 120

aodanxin avatar Jan 23 '24 18:01 aodanxin

Does anybody who is facing this issue have a public repo available where this problem occurs and can be looked at?

Chrome tests in GitHub Actions https://github.com/cypress-io/github-action/actions/workflows/example-chrome.yml are not showing this problem.

Is this only a problem on macOS like the original issue post, or are other operating systems also showing problems?

@sarah-vendredi Are you still experiencing this issue?

MikeMcC399 avatar Jan 24 '24 13:01 MikeMcC399

Does anybody who is facing this issue have a public repo available where this problem occurs and can be looked at?

Chrome tests in GitHub Actions https://github.com/cypress-io/github-action/actions/workflows/example-chrome.yml are not showing this problem.

Is this only a problem on macOS like the original issue post, or are other operating systems also showing problems?

@sarah-vendredi Are you still experiencing this issue?

this is happening to me in AzureDevops with Linux:

Cypress: 12.17.3
Browser: Chrome 121 (headless)
Node Version: v18.19.0 (/usr/local/bin/node)

is there any workaround?

damasofc avatar Feb 08 '24 18:02 damasofc

@MikeMcC399 I forked the cypress.io "cypress-realworld-testing-course-app" and run into the same error.

Cypress: 13.6.4 Browser: Chrome (121.0.6167.160) Node: 20.9.0

Forked Realworld-Testing-Course-App

mauschepano avatar Feb 09 '24 08:02 mauschepano

@mauschepano

Thanks for your feedback! Which operating system were you using?

MikeMcC399 avatar Feb 09 '24 09:02 MikeMcC399

@mauschepano

Is the error condition permanent or do the tests work if you run them again?

I tried the following repro steps using:

  • current Node.js LTS version 20.11.0
  • Google Chrome Version 121.0.6167.161 (Windows) / 121.0.6167.160 (Ubuntu)
git clone --branch final https://github.com/cypress-io/cypress-realworld-testing-course-app
cd cypress-realworld-testing-course-app
npm ci
npm install [email protected] -D
npm run dev

In a separate terminal

npx cypress run --browser chrome

On Ubuntu I once saw

Still waiting to connect to Chrome, retrying in 1 second (attempt 18/62) then the test user-journey.cy.ts failed with a timeout.

When I ran it again, it all worked with no warnings or errors.

MikeMcC399 avatar Feb 09 '24 10:02 MikeMcC399

@MikeMcC399

I am using MacOS (14.3.1).

Initially, I was able to launch the test app using npx cypress open At some point, Cypress stopped launching altogether, and I received the message "Still waiting to connect to Chrome, retrying in 1 second". However, I had to restart the command after each test because Chrome was no longer responsive.

Today, I checked out the repository again and followed your instructions - it's working so far!

mauschepano avatar Feb 12 '24 05:02 mauschepano

Having the same problem Chrome version: 121 Cypress Version: 13.6.4 Test runner only works with electron version which is 114

oguzhantx avatar Feb 13 '24 16:02 oguzhantx

Been experiencing the same problem at my company in our gitlab ci setup. Cypress version 13.5.0.

mankittens avatar Feb 16 '24 20:02 mankittens

I when I used this image tag: node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1 works as expected all Chromium based browsers (Chrome, edge, etc); but not the firefox. Any advise. (Run Starting) 11:44:26 ──────────────────────────────────────────────────────── 11:44:26 │ Cypress: 13.6.6 │ 11:44:26 │ Browser: Firefox 118 (headless) │ 11:44:26 │ Node Version: v20.9.0 (/usr/local/bin/node) │ 11:44:26 │ Specs: 1 found (start-page-nina.cy.ts) │ 11:44:26 │ Searched: cypress/e2e/nina/* │ ──────────────────────────────────────────── 11:44:26
11:44:26 Running: start-page-nina.cy.ts (1 of 1) 11:45:34 Timed out waiting for the browser to connect. Retrying... 11:45:34 Still waiting to connect to Firefox, retrying in 1 second (attempt 18/62) 11:45:34 Still waiting to connect to Firefox, retrying in 1 second (attempt 18/62)

Rajesh-Kodandam avatar Feb 27 '24 12:02 Rajesh-Kodandam

@Rajesh-Kodandam

This problem has been reported by different users and so far no root cause has been identified, so it's difficult to give any advice.

I checked on GitHub Actions running cypress/browsers:latest (which is currently equivalent to cypress/browsers:node-20.11.0-chrome-121.0.6167.184-1-ff-123.0-edge-121.0.2277.128-1) with Cypress 13.6.6 and there was no problem connecting to any browser (chrome, edge, electron, firefox) to run a simple Cypress test.

Since the issue you have added your comment to is about Firefox, not Chrome, and it does not concern running in a Cypress Docker image, you may want to open a new Cypress issue and provide full debug logs.

MikeMcC399 avatar Feb 27 '24 14:02 MikeMcC399

@MikeMcC399 The issue is about Firefox not working using when the Docker image (node-20.11.0-chrome-121.0.6167.184-1-ff-123.0-edge-121.0.2277.128-1) usede and its not regarding the chrome.

Rajesh-Kodandam avatar Feb 27 '24 14:02 Rajesh-Kodandam

@Rajesh-Kodandam

The issue is about Firefox not working using when the Docker image (node-20.11.0-chrome-121.0.6167.184-1-ff-123.0-edge-121.0.2277.128-1) usede and its not regarding the chrome.

I am so sorry. 🤭 I wrote Chrome and Firefox exactly the wrong way around! I've corrected my post https://github.com/cypress-io/cypress/issues/27915#issuecomment-1966629954 now. The conclusion is still correct though, that it would be clearer if you could open a new issue. Have you checked that the issue with Firefox is repeatable?

MikeMcC399 avatar Feb 27 '24 14:02 MikeMcC399

Thaank you, Already created new issue for the same. Much appriciated for quick response.

Rajesh-Kodandam avatar Feb 27 '24 14:02 Rajesh-Kodandam

@Rajesh-Kodandam

  • It's good that you opened a new issue https://github.com/cypress-io/cypress/issues/29018.

MikeMcC399 avatar Feb 27 '24 15:02 MikeMcC399

FYI, you can workaround this if you use the Chromium browser packaged with pupeeter and dynamically update your browser list to use this, it's then available to Cypress and the tests pass.

EM-Creations avatar Apr 30 '24 19:04 EM-Creations