cypress: Error: could not find CRI target / Failed to connect to Chrome
Current behavior:
cypress run --headless --browser chrome is failing in GitHub Actions with this error:
Failed to connect to Chrome, retrying in 1 second (attempt 18/32)
could not find CRI target
Error: could not find CRI target
at lazyAssLogic (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/lazy-ass/index.js:110:14)
at lazyAss (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/lazy-ass/index.js:115:28)
at /home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/lib/browsers/protocol.js:81:5
at tryCatcher (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/runner/.cache/Cypress/3.8.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:439:21)
Link to the failing build: https://github.com/sweetalert2/sweetalert2/runs/365206238
Steps to reproduce: (app code and test code)
Here’s the GitHub Actions configuration: https://github.com/sweetalert2/sweetalert2/blob/master/.github/workflows/coverage.yml
The cy:run command is defined here: https://github.com/sweetalert2/sweetalert2/blob/master/package.json#L98
Versions
Cypress: 3.8.1 Operating System: Ubuntu 18.04
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 20
- Comments: 41 (22 by maintainers)
Commits related to this issue
- chore: disable cypress tests for now re-enable when https://github.com/cypress-io/cypress/issues/6053 is fixed — committed to sweetalert2/sweetalert2 by limonte 5 years ago
- chore: disable cypress tests for now re-enable when https://github.com/cypress-io/cypress/issues/6053 is fixed — committed to sweetalert2/sweetalert2 by limonte 5 years ago
Hi @jennifer-shehane this has been happening for me on GitHub Actions on Ubuntu latest (and on also on my local Mac) so I’m not sure it is Mac specific. Also - only happening in Chrome headless mode and only when changing specs (never when running a single spec). I’ve noticed the Chrome instance stays up and I have to kill all instances to get the tests to work again at all.
<offtopic>@hunghau there’s the “Subscribe” button for that purpose:
</offtopic>@xdumaine We release every 2 weeks - so this should be released today (1/24/20) barring no complications with the release.
With above in mind, I found a way to recreate the problem as follows:
After 3-6 tries I get the “cannot find CRI target” message, the following terminal output in Cypress
But then I can in another tab do the following (I am using same port that
CRI.List on port 52765reportsSo it seems to me
CRI.Listcan return “too early” and we should retry it until we do findabout:blankFriday releases. Classic 😆
Ok, got the error on Mac
Then it failed to connect
The terminal is showing
The Chrome Canary looks like this
BUT I can query the list of connection targets on port 51298
which does include
about:blanktarget.Then there was the following observation:
agree with @flotwig in https://github.com/cypress-io/cypress/issues/6053#issuecomment-572667915 - I am playing with Docker container, trying to restrict CPU usage to slow down Chrome start up to see if that “helps”. I am also thinking of installing a bunch of chrome extensions locally or loading them in Chrome to see this behavior
This is most likely because it gets hit while Chrome is still “starting up”. Maybe we need to include this line in the same retry loop that the TCP CDP connection uses.
I also run into this issue but not always. Mostly if I start “cypress run” twice in a row.The issur started since the update from 3.8.0 to the new patch release
I’m to the point that I cannot run cypress on my mac, because I get this error so constantly. Any idea when this will be released? downgrading cypress didn’t fix it.
I don’t see how disabling GPU affects it, but who knows? It could be a combination of headless Chrome and environment. Just to see if we can recreate this I have added headless Chrome test runs to our repos
could not find CRI target, so the good news is this is not just GitHub Action, but CircleCI as wellI’m also getting this error occasionally. (Running within a Docker container, so I don’t think it’s due to multiple Chrome sessions being open, unless from a previous test suite.)
This happened for me in 3.8.1 when using the Cypress Module API (
cypress.run) with{browser: 'chrome', headless: true, headed: false}(aside: why are there two flags for this?)But 3.8.0 has https://github.com/cypress-io/cypress/issues/5949 so you still won’t be able to use Chrome headless if you downgrade.
Seeing this error after upgrading Node version to v12 and Chrome to v79 (Cypress version unchanged).Update: this was a coincidence of timing. We are seeing this error in about 1/2 of our test runs.