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

Current behavior

Randomly on a very slow windows machine I get this error:

Still waiting to connect to Edge, 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 Edge browser.

The CDP port requested was 50325.

Error: connect ECONNREFUSED 127.0.0.1:50325
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)

Desired behavior

Cypress is able to connect to Chrome DevTools Protocol in X seconds. Please give a way to increase the timeout, or fix the issue that makes the connection fail.

Test code to reproduce

The problem is machine dependent, not code dependent, it can fail with any test.

Cypress Version

13.1.0

Node version

18.4.0

Operating System

Windows 10

Debug Logs

No response

Other

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 3
  • Comments: 44 (18 by maintainers)

Most upvoted comments

@alasdairrobinson

Thank you very much for reporting back your success!

It’s working:

Image

Thanks again @MikeMcC399

@MikeMcC399 Thanks, I’ll try something similar in our yaml.

@Nmasmae

how did it work for you? i currently have the same issue!

I didn’t do anything special to make it work. You can see the workflow on https://github.com/MikeMcC399/github-action/blob/test/edge-all-os/.github/workflows/example-edge.yml

Unfortunately I don’t have the skills to debug why it is taking a long time for Cypress to establish a connection to Edge. I also don’t know why it doesn’t appear to be a problem on the GitHub macos-13 runner, but only on Ubuntu and Windows.

Since the connection time is long and variable, for some situations it succeeds and in other environments it times out. I made some other observations last year in https://github.com/cypress-io/cypress/issues/27830#issuecomment-1774829043. There hasn’t been any feedback on those points so far.

So after some more pipeline runs, it seems Node 20.x makes it more reliable but not perfectly, I’ve had a crash due to this problem once out of 8 runs. It really feels not normal not to have this kind of feature running without the fear of a crash happening.

On GitHub Actions workflow https://github.com/MikeMcC399/github-action/actions/runs/9894339824/job/27331610912 I am seeing Cypress having a hard time connecting to Edge 126 on Ubuntu and Windows. In the end, it does succeed. macOS showed no issue, but that may be coincidence.

It seems that there is still an underlying open problem.

┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        13.13.0                                                                        │
  │ Browser:        Edge 126 (headless)                                                            │
  │ Node Version:   v20.13.1 (/home/runner/runners/2.317.0/externals/node20/bin/node)              │
  │ Specs:          1 found (spec.cy.js)                                                           │
  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  spec.cy.js                                                                      (1 of 1)
before launching browser
{
  name: 'edge',
  family: 'chromium',
  channel: 'stable',
  displayName: 'Edge',
  version: '126.0.2592.87',
  path: 'microsoft-edge',
  minSupportedVersion: 79,
  majorVersion: '126',
  isHeadless: true,
  isHeaded: false
}
Still waiting to connect to Edge, retrying in 1 second (attempt 18/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 19/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 20/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 21/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 22/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 23/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 24/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 25/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 26/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 27/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 28/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 29/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 30/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 31/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 32/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 33/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 34/62)
Still waiting to connect to Edge, retrying in 1 second (attempt 35/62)


top window inner w, h is [123](https://github.com/MikeMcC399/github-action/actions/runs/9894339824/job/27331610912#step:3:124)2x645
  ✓ works (2501ms)

  1 passing (4s)

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

For me it was working on Cypress 13.2.0, but its not working on 13.3.0. Using docker image with tag (cypress-13.3.0-node-20.6.1-chrome-116.0.5845.187-1-ff-117.0-edge-116.0.1938.76-1) and gitlab pipeline

Have the same issue in the Github Actions pipeline + locally, everything worked fine two weeks ago.

Since maybe it’s hard for you to reproduce and fix, and maybe can just be fixed by increasing the timeout. Can’t you just expose the option to increase the timeout? Something like browserConnectionTimeout in cypress.config.ts.