-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Timed out waiting for the browser to connect - Cannot read properties of null (reading 'getWebSocketDebuggerUrl') #28397
Comments
Similar issue with Chrome instead of Headless: #27915 |
I encounter the same problem in gitlab CI, running Cypress 13.4.0 with Node 18 and Chrome 110 |
@jeremyriverain Oh, I was going to suggest downgrading to 13.4.0 to see if this issue is resolved. 😕 @danielbayerlein Can you try downgrading to 13.4.0 to see if your issue specifically is resolved? Could you run Cypress in debug mode mode and print the entire set of logs here? |
I tried to downgrade to 13.3 and still got a timeout waiting for the browser (without the Websocket part though) downgrading to v12 seems to work now. It doesn't happen reliably every time, but it feels like 50% of our CI runs are effected since upgrading Cypress from 9 to 13 in a section of our repo EDIT: downgrading to 12 encountered a similar issue. Tried to upgrade again setting this env variable, without additional success: |
@jennifer-shehane Same issue with version 13.4.0 |
We've encountered the same issue and found out that version 13.2 works, but 13.4 or 13.6 don't. |
Experiencing the same issue in our CI with the following setup:
|
I'm on the same boat, any updates on possible fixes?
|
We've worked around it by setting the Oddly enough, I believe we were seeing this behavior previously with Chrome, and it only recently started happening with Electron. I think Electron used to wait to start looking for the browser until after compilation had finished. |
Hi @cg-roling, how did you set the |
Hello, I am experiencing the same issue.
I dont know how to properly set the CYPRESS_INTERNAL_BROWSER_CONNECT_TIMEOUT. How can i do it ? I have tried to do something like this but the problem still persist...
Has anyone found another solution ? |
If it helps, I have cypress locked to Every time I try to upgrade, it works locally, but fails in CI (github-actions). |
Same issue, cypress |
I have also just downgraded our project cypress version to
Will report of any issues moving forward with |
We have this problem as well. Going from |
When I look at the code where that env variable is used seems like it's expected to exist in the OS's env variables list. So what you need to do is set an OS env variable before running the tests. Something like this, in your package.json file should work:
|
We were able to fix our issue by adding |
We're also using the |
Any chance this issue can get some love? We encounter this error multiple times a day with Gitlab CI v16.10.2-ee and Cypress v13.6.3. I cannot downgrade to a working version of Cypress (v13.2.0) because we need TS features from the most recent version. It's like a 50/50 shot if this appears on any given CI run, and I'm not being hyperbolic |
Still happening on 13.8.1 |
I looked through all of the commits between 13.2.0 and 13.4.0 and is is really not obvious what the problem could be. I didn't immediately see where any code would have been touched affecting this area. Ideally a reproducible example will allow us to investigate. |
Actually I may have tracked this down to this PR: #28180 which means it would have been introduced in 13.5.0. That doesn't exactly account for people saying that updating to 13.4.0 doesn't resolve the issue though. |
I'm having a lot of issues reproducing this in the wild, but since @UlanaXY sent over some debug logs, I was able to go through those and get a rough idea as to what is happening. From what I can see it looks related to the work done in #28180 (and maybe colliding with #25898?). Going through the logs, I can see that the browser has two tabs set up at time of log availability (i.e. two targets). This is not normal from what I can see on regular runs. There should only be one target tab, plus the debugger port. The two targets in this case are as follows:
We can also see later on in the logs that after:browser:launch is NOT set up (at least according to the logs). We can see a new process is being opened, but there is likely a launchAttempt mismatch, so the process is killed. When this happens:
It looks like 5CF5B7DE5262708EB8D79991A162D0D4 is the active target but its CRI client is now closed, as we can see that later on we get the log that the CRI client is disconnected, but will not reconnect to it because its closed, meaning when we try to access the getWebSocketDebuggerUrl on target 5CF5B7DE5262708EB8D79991A162D0D4, it is Since this is in the general CRI client and likely a bug with how we are handling multiple browser/tab instances / mismatch on the active instance, it explains why its very intermittent (since it requires multiple tabs to be active) and can happen in any supported browser. (why we see it in electron and chromium). Hypothetically a user could create a new tab with the puppeteer plugin which could have some side effects. @UlanaXY, @danielbayerlein or anyone else confirm if you are using this feature or not? My best guess is that the correct behavior would be only one target from the start, and if two are required for other reasons (possibly the puppeteer plugin or a user clicked on an external link that opened another tab?), the CRI client that needs to be disconnected also needs to be the target that is destroyed. Is anyone else able to send debugger logs to verify similar behavior? Since I can't reproduce the issue, @UlanaXY 's logs are the best I have to go off of for now. Even better if someone has a reproducible example! |
@AtofStryker How come setting the env variable |
I've been working on @ryanthemanuel on the issue and it looks like we can mock the reproduction of the issue 🎉 (specifically to electron) to force the first instance of the browser to time out rapidly and create an orphaned browser process 4d80ef8. A possible solution might be to preserve the CRI client in the case of electron since the browser instance is really shared across windows, so the CRI client should be the same. Still confirming and testing... |
My best guess is that |
For me, it was a standard run. I didn't try to create multiple tabs, or anything similar. My test includes |
Current behavior
Since updating to Node v20.9.0 and Cypress v13.6.0, my tests are failing with a timeout error. The problem only occurs in the CI (gitlab-runner 16.5.0).
Desired behavior
No response
Test code to reproduce
Cypress Version
13.6.0
Node version
20.9.0
Operating System
public.ecr.aws/cypress-io/cypress/base:20.9.0
Debug Logs
No response
Other
Browser: Electron 114 (headless)
The text was updated successfully, but these errors were encountered: