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 · 51 comments
Labels
stage: awaiting response Potential fix was proposed; awaiting response

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)

@superdrenner
Copy link

@MikeMcC399

Here are the debug logs that I just got from a failure. This is with Cypress 13.11 and Chrome 124. The issue is very intermittent. If there are better logs, let me know what I can adjust the DEBUG value to and I'll post them.

 cypress:server:browsers browsers.kill called with no active instance +0ms
  cypress:server:browsers getBrowserLauncher { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '124.0.6367.60', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '124', isHeadless: true, isHeaded: false } } +0ms
  cypress:server:browsers opening browser { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '124.0.6367.60', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '124', isHeadless: true, isHeaded: false } +2ms
 DONE  Compiled successfully in 11598ms7:37:05 PM
assets by status 6.56 MiB [cached] 33 assets

... webpack stuff

  cypress:server:browsers browsers.kill called with no active instance +1m
Timed out waiting for the browser to connect. Retrying...
  cypress:server:browsers browsers.kill called with no active instance +1ms
  cypress:server:browsers getBrowserLauncher { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '124.0.6367.60', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '124', isHeadless: true, isHeaded: false } } +0ms
  cypress:server:browsers opening browser { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '124.0.6367.60', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '124', isHeadless: true, isHeaded: false } +1ms
  cypress:server:browsers browser opened for launch 1 +600ms
  cypress:server:browsers killing process because launch attempt: 1 does not match current launch attempt: 2 +1ms
  cypress:server:browsers killing browser process +0ms
  cypress:server:browsers browser process killed +14ms
Still waiting to connect to Chrome, retrying in 1 second (attempt 18/62)
...a few of these
Still waiting to connect to Chrome, retrying in 1 second (attempt 62/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.
The CDP port requested was 36876.
Error: connect ECONNREFUSED 127.0.0.1:36876
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
  cypress:server:browsers browsers.kill called with no active instance +50s

@jennifer-shehane
Copy link
Member

Please try updating to the latest Cypress version to see if this issue is resolved. We have resolved several browser connection error situations and this may already be fixed.

@jennifer-shehane jennifer-shehane added stage: awaiting response Potential fix was proposed; awaiting response and removed stage: needs information Not enough info to reproduce the issue labels Jul 8, 2024
@roelae
Copy link

roelae commented Jul 19, 2024

im having this problem when running in azure, cypress version is 13.13.1 and chrome is 126
image

@MikeMcC399
Copy link
Contributor

@roelae

The Node.js version v16.20.2, shown in your logs, is no longer supported. If possible update to use the LTS version: currently v20.15.1

@roelae
Copy link

roelae commented Jul 22, 2024

@roelae

The Node.js version v16.20.2, shown in your logs, is no longer supported. If possible update to use the LTS version: currently v20.15.1

i upgraded my node version, still having the issue
image

@j1000
Copy link

j1000 commented Jul 31, 2024

I'm still having the issue too.

Windows
Node v22.2.0
Cypress v13.13.1

@AdanAraujoQA
Copy link

AdanAraujoQA commented Aug 6, 2024

I'm having the same trouble.
Cypress: 13.13.2
node: 22.6.0
image

@AdanAraujoQA
Copy link

@jennifer-shehane
Copy link
Member

Could you run Cypress in debug mode mode and print the entire set of logs here?

@alexsch01
Copy link
Contributor

alexsch01 commented Sep 9, 2024

@jennifer-shehane since Chrome 128, I've been seeing this
I think it could be caused by an extension installed by chrome://policy that's preventing Cypress from launching randomly

@Matias0432
Copy link

Buenos dias. ¿Se tiene solucion para el inconveniente de ?

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

@aholland
Copy link

aholland commented Oct 3, 2024

Buenos dias. ¿Se tiene solucion para el inconveniente de ?

Are you on Chrome 129? I upgraded to Version 129.0.6668.90 (Official Build) (arm64) today and immediately began having this issue.

@aholland
Copy link

aholland commented Oct 3, 2024

Buenos dias. ¿Se tiene solucion para el inconveniente de ?

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

@Matias0432 - I had this problem after upgrading to 129. The problem was solved once I closed Cypress, closed all instance of Chrome (Cmd-Q on Mac) and then started Cypress again. I am now able to open Chrome from the Cypress "Choose a browser" page and have Cypress successfully connect and set the URL etc.

@Matias0432
Copy link

@aholland lamentablemente sigo con las mismas falla !!!

@MikeMcC399
Copy link
Contributor

See also Troubleshooting > Clear App Data.

This is known to solve the issue in some circumstances.

@nukuld
Copy link

nukuld commented Oct 25, 2024

Hello! I have also encountered the connection Error issue. I just installed cypress, I cleared the app data, added some nodeEvents from Cypress that should bypass something frome chrome, but still nothing worked for me. I only encounter this issue for the Chrome browser. Below is a pastebin with all of the logs I could copy of the issue.

https://pastebin.com/q32XWuWr

@muz234
Copy link

muz234 commented Nov 6, 2024

Hello! Im facing the similar issue with chrome browser throwing error:

Timed out after waiting 60000ms for your remote page to load.

Your page did not fire its load event within 60000ms.

You can try increasing the pageLoadTimeout value in 

This issue is only faced during headless mode in both MAC and ubuntu instances.
I have also set chromeWebSecurity: false, to disable web security features and still no change.

Cypress v13.15.1
Chrome

  • Name: chrome
  • Channel: stable
  • Version: 130.0.6723.117
  • Executable: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

Looking for some suggestion to work around this issue.

@bvandercar-vt
Copy link

See also Troubleshooting > Clear App Data.

This is known to solve the issue in some circumstances.

I am having the same problem; this time this solution isn't working.

@grancu
Copy link

grancu commented Nov 28, 2024

Hi,
I got the same issue with cypress complaining that "Still waiting to connect to Chrome, retrying in 1 second (attempt 42/62)
cypress:network:connect received error on connect, retrying { iteration: 42, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:51452 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 51452 } } +1s"

Re-installing chrome solved the issue for me. This issue started as soon as I installed Windows updates and chrome updates. Before this, chrome lost sync as well. So I am assuming that something did not quite work with the updates and there was some incompatibility.

Hope re-installing chrome works for you too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: awaiting response Potential fix was proposed; awaiting response
Projects
None yet
Development

No branches or pull requests