cypress: Error: could not find CRI target (Cypress 4.6.0)
Current behavior:
cypress run fails with the following error on Chrome:
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 26359.
Error details:
Error: could not find CRI target
at lazyAssLogic (C:\Users\user\AppData\Local\Cypress\Cache\4.6.0\Cypress\resources\app\packages\server\node_modules\lazy-ass\index.js:110:14)
at Object.lazyAss (C:\Users\user\AppData\Local\Cypress\Cache\4.6.0\Cypress\resources\app\packages\server\node_modules\lazy-ass\index.js:115:28)
at findStartPage (C:\Users\user\AppData\Local\Cypress\Cache\4.6.0\Cypress\resources\app\packages\server\lib\browsers\protocol.js:56:23)
Full log is also attached.
Note that this doesn’t appear to be 100% consistent. With the below example I am seeing this maybe 25% of the time.
We had previously observed this before, and upgraded to both 3.8.3 as a result of: https://github.com/cypress-io/cypress/issues/6053
Then more recently, upgraded to 4.6.0 as a result of: https://github.com/cypress-io/cypress/issues/6518
Still observing on 4.6.0 as below though
Desired behavior:
Execution should not fail in this manner.
Test code to reproduce
- Clone https://github.com/stevejefferies/cypress-test-tiny
- Run
cypress:runas defined in package.json e.g.npm run cypress:run
Versions
Cypress: 4.6.0 Browser: Chrome 83 OS: Windows 10
Debug Log
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 32 (5 by maintainers)
Should have added to my comment above, for those looking for a potential workaround adding the disable-gpu flag on browser launch (plugins/index.js) seems stable for me at least locally: Cypress 4+:
Or before Cypress 4:
@nids2307 try below code in Plugins/index.js its working
Since chrome 83 was installed we also have this issue.
Did some digging on this. This looks to be a Chrome issue in that the underlying issue observed (no targets returned from call to CDP.List in chrome remote interface) can be replicated outside of Cypress completely. e.g.:
results in an empty list - as you see when this fails in Cypress.
Digging further, it appears to be down to the Chrome renderer child process crashing. There are numerous open tickets with the Chromium project which highlight this issue so its hard to determine the actual stability of this. But a few options I tried from the issues in the Chromium project do seem to have solved this from my limited local testing (Win 10 only):
--disable-gpuflag on browser launch, as Cypress already does for Chrome on linux--use-gl=desktop/swiftshaderboth seem to give stable results locallyIs there a reason why Cypress only sets
--disable-gpufor linux (here)? Happy to make this fix.I also found the same error as @stevejefferies found
I am facing this issue for both chrome and edge browser, It’s working on cypress open UI but not able to run on the headless browser and not in CI environment also.
Any update on this issue ?