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

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

Open
sarah-vendredi opened this issue Sep 27, 2023 · 32 comments
Labels
stage: needs information Not enough info to reproduce the issue

Comments

@sarah-vendredi
Copy link

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

@MikeMcC399
Copy link
Contributor

@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 ECONNRESET on Chrome/Chromium 117.0.5851.0 when using Cypress <12.15.0 or passing--headless=old in browser launch options #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.)

@multivoltage
Copy link

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)

@MikeMcC399
Copy link
Contributor

@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.

@multivoltage
Copy link

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

@MikeMcC399
Copy link
Contributor

@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.

@veceslavsv
Copy link

veceslavsv commented Nov 13, 2023

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

@magarwal19
Copy link

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

@danielbayerlein
Copy link

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)

@MikeMcC399
Copy link
Contributor

@danielbayerlein

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

Browser: Electron 114 (headless)

@cxh324
Copy link

cxh324 commented Nov 30, 2023

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

@terohuomo
Copy link

terohuomo commented Dec 1, 2023

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.

@magarwal19
Copy link

magarwal19 commented Dec 5, 2023

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

seems some changes after 12.4.0 are causing this

@kolomietsan
Copy link

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

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jan 5, 2024
@EM-Creations
Copy link

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.

@aodanxin
Copy link

aodanxin commented Jan 23, 2024

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

@MikeMcC399
Copy link
Contributor

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?

@damasofc
Copy link

damasofc commented Feb 8, 2024

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?

@mauschepano
Copy link

@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

@MikeMcC399
Copy link
Contributor

@mauschepano

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

@MikeMcC399
Copy link
Contributor

@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 cypress@13.6.4 -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.

@mauschepano
Copy link

@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!

@oguzhantx
Copy link

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

@mankittens
Copy link

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

@Rajesh-Kodandam
Copy link

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)

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Feb 27, 2024

@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.

@Rajesh-Kodandam
Copy link

Rajesh-Kodandam commented Feb 27, 2024

@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.

@MikeMcC399
Copy link
Contributor

@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 #27915 (comment) 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?

@Rajesh-Kodandam
Copy link

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

@EM-Creations
Copy link

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.

@jessicapeng
Copy link

Aside from the incompatibility of chrome/cypress and those fixes this behavior also occurs if you have cypress running in another place so you can close all instances of cypress running and try running it up again.

@MateusRodriguesCosta
Copy link

Having the same problem, on CI it works smoothly with static Chrome 111. But running on local has two scenarios: running Cypress 12.4 or lower shows the Author's timeout, and running v13 or above gives the 'connect ECONNREFUSED 127.0.0.1:4200'.

Chrome version: 124.0.6367.202
Cypress Version: 13.9.0
Node version: 18.20.2 (LTS)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue
Projects
None yet
Development

No branches or pull requests