Cypress: Cypress 3.8.1 with Google Chrome 79 sometimes failing with "Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds."

Created on 12 Feb 2020  路  15Comments  路  Source: cypress-io/cypress

Current behavior:

Using Cypress 3.8.1 with Google Chrome 79 tests sometimes failing with the error:

  Running:  e2e/mycooltest.js                                               (15 of 28)
Failed to connect to Chrome, retrying in 1 second (attempt 18/32)
Failed to connect to Chrome, retrying in 1 second (attempt 19/32)
Failed to connect to Chrome, retrying in 1 second (attempt 20/32)
Failed to connect to Chrome, retrying in 1 second (attempt 21/32)
Failed to connect to Chrome, retrying in 1 second (attempt 22/32)
Failed to connect to Chrome, retrying in 1 second (attempt 23/32)
Failed to connect to Chrome, retrying in 1 second (attempt 24/32)
Failed to connect to Chrome, retrying in 1 second (attempt 25/32)
Failed to connect to Chrome, retrying in 1 second (attempt 26/32)
Failed to connect to Chrome, retrying in 1 second (attempt 27/32)
Failed to connect to Chrome, retrying in 1 second (attempt 28/32)
Failed to connect to Chrome, retrying in 1 second (attempt 29/32)
Failed to connect to Chrome, retrying in 1 second (attempt 30/32)
Failed to connect to Chrome, retrying in 1 second (attempt 31/32)
Failed to connect to Chrome, retrying in 1 second (attempt 32/32)
Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.

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

The CDP port requested was 42207.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:42207
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)

It always seems to happen on starting new test, never in the middle of a test.

Desired behavior:

Cypress always can connect to chrome when it's needed.

Test code to reproduce

Can't see any specific patterns. Seems to happens time to time in random places.

Versions

Cypress - 3.8.1
Google Chrome - 79
Cypress docker image - cypress/browsers:node13.3.0-chrome79-ff70
OS - ubuntu xenial

Most helpful comment

I experience this too with latest "cypress": "4.4.1".

Sometimes, not everytime and without any code change, I get this error at the middle of the tests. As @sergeyKhristenko said, always when cypress starts a new test in my all tests suite, not in middle of one test.

Very difficult to reproduce as it happens quite randomly.

All 15 comments

Would you recommend any workaround for this? Other than switching to Electron or rerunning entire suite.

3.8.1 isn't the latest release. Have you tested with 3.8.3?

I see that you are using an older version of Cypress. Please update to the current version of Cypress and comment if this is still happening for you and we will consider reopening the issue. Your issue may have already been fixed.

I see that this issue was fixed on 3.8.1 (https://github.com/cypress-io/cypress/issues/5912). I am on 3.8.2 and still have exactly the same issue. Though it's sporadic, and came up only after a couple of weeks on 3.8.2.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

Hi,
I have a similar error on Chromium 80 with Cypress 4.1:

The CDP port requested was 37435.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:37435 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)

There is no step to reproduce except following the getting started tutorial, it fails when running the test.

I experience this too with latest "cypress": "4.4.1".

Sometimes, not everytime and without any code change, I get this error at the middle of the tests. As @sergeyKhristenko said, always when cypress starts a new test in my all tests suite, not in middle of one test.

Very difficult to reproduce as it happens quite randomly.

4.11.0 Still happening

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

Hi there,

I have a similar error:

  • For me, It is always happening start from the 2nd test Cucumber BDD feature file.
  • Chrome: Version 81.0.4044.129 (Official Build) (64-bit)
  • Dependencies:
    "cypress": "^4.10.0",
    "cypress-cucumber-preprocessor": "^2.5.4",
    "cypress-image-snapshot": "^3.1.1",
    "cypress-wait-until": "^1.7.1",
    "multiple-cucumber-html-reporter": "^1.17.0"

`Timed out waiting for the browser to connect. Retrying...
Failed to connect to Chrome, retrying in 1 second (attempt 18/62)
Failed to connect to Chrome, retrying in 1 second (attempt 19/62)
Failed to connect to Chrome, retrying in 1 second (attempt 20/62)
Failed to connect to Chrome, retrying in 1 second (attempt 21/62)
Failed to connect to Chrome, retrying in 1 second (attempt 22/62)
Failed to connect to Chrome, retrying in 1 second (attempt 23/62)
Failed to connect to Chrome, retrying in 1 second (attempt 24/62)
Failed to connect to Chrome, retrying in 1 second (attempt 25/62)
Failed to connect to Chrome, retrying in 1 second (attempt 26/62)
Failed to connect to Chrome, retrying in 1 second (attempt 27/62)
Failed to connect to Chrome, retrying in 1 second (attempt 28/62)
Failed to connect to Chrome, retrying in 1 second (attempt 29/62)
Failed to connect to Chrome, retrying in 1 second (attempt 30/62)
Failed to connect to Chrome, retrying in 1 second (attempt 31/62)
Failed to connect to Chrome, retrying in 1 second (attempt 32/62)
Failed to connect to Chrome, retrying in 1 second (attempt 33/62)
Failed to connect to Chrome, retrying in 1 second (attempt 34/62)
Failed to connect to Chrome, retrying in 1 second (attempt 35/62)
Failed to connect to Chrome, retrying in 1 second (attempt 36/62)
Failed to connect to Chrome, retrying in 1 second (attempt 37/62)
Failed to connect to Chrome, retrying in 1 second (attempt 38/62)
Failed to connect to Chrome, retrying in 1 second (attempt 39/62)
Failed to connect to Chrome, retrying in 1 second (attempt 40/62)
Failed to connect to Chrome, retrying in 1 second (attempt 41/62)
Failed to connect to Chrome, retrying in 1 second (attempt 42/62)
Failed to connect to Chrome, retrying in 1 second (attempt 43/62)
Failed to connect to Chrome, retrying in 1 second (attempt 44/62)
Failed to connect to Chrome, retrying in 1 second (attempt 45/62)
Failed to connect to Chrome, retrying in 1 second (attempt 46/62)
Failed to connect to Chrome, retrying in 1 second (attempt 47/62)
Failed to connect to Chrome, retrying in 1 second (attempt 48/62)
Failed to connect to Chrome, retrying in 1 second (attempt 49/62)
Failed to connect to Chrome, retrying in 1 second (attempt 50/62)
Failed to connect to Chrome, retrying in 1 second (attempt 51/62)
Failed to connect to Chrome, retrying in 1 second (attempt 52/62)
Failed to connect to Chrome, retrying in 1 second (attempt 53/62)
Failed to connect to Chrome, retrying in 1 second (attempt 54/62)
Failed to connect to Chrome, retrying in 1 second (attempt 55/62)
Failed to connect to Chrome, retrying in 1 second (attempt 56/62)
Failed to connect to Chrome, retrying in 1 second (attempt 57/62)
Failed to connect to Chrome, retrying in 1 second (attempt 58/62)
Failed to connect to Chrome, retrying in 1 second (attempt 59/62)
Failed to connect to Chrome, retrying in 1 second (attempt 60/62)
Failed to connect to Chrome, retrying in 1 second (attempt 61/62)
Failed 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 49379.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:49379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)`

It is worth to mention it is always happening after the 18th attempt
Failed to connect to Chrome, retrying in 1 second (attempt 18/62).

It is worth to mention it is always happening after the 18th attempt
Failed to connect to Chrome, retrying in 1 second (attempt 18/62).

I can confirm this from my end, always failed on the 18th

Tests are slow, so you say run headless chrome it is faster.. but headless chrome fails to connect 80% of the time....

THIS FIXES THIS PROBLEM!!! by @simisimon in https://github.com/cypress-io/cypress/issues/6540#issuecomment-641087834_

THIS FIXES THIS PROBLEM!!! by @simisimon in #6540 (comment)_

Thank you. Helped me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

verheyenkoen picture verheyenkoen  路  3Comments

rbung picture rbung  路  3Comments

carloscheddar picture carloscheddar  路  3Comments

brian-mann picture brian-mann  路  3Comments

jennifer-shehane picture jennifer-shehane  路  3Comments