cypress: Timed out waiting for the browser to connect - Cannot read properties of null (reading 'getWebSocketDebuggerUrl')

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).

Running: login/login.cy.ts (1 of 9)
Timed out waiting for the browser to connect. Retrying...
Cannot read properties of null (reading 'getWebSocketDebuggerUrl')
TypeError: Cannot read properties of null (reading 'getWebSocketDebuggerUrl')
at Object.open (:4454:111131)
at async Object.open (:4460:27335)
at async v.relaunchBrowser (:4526:36933)

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)

About this issue

  • Original URL
  • State: open
  • Created 7 months ago
  • Reactions: 10
  • Comments: 22 (3 by maintainers)

Most upvoted comments

We’ve worked around it by setting the CYPRESS_INTERNAL_BROWSER_CONNECT_TIMEOUT environment variable to 300000, a tip we picked up from #26936.

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.

Actually I may have tracked this down to this PR: https://github.com/cypress-io/cypress/pull/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.

We have this problem as well. Going from 13.6.4 to 13.2.0 works for us as well, but certainly just a workaround until the problem is fixed.

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

If it helps, I have cypress locked to 13.2.0 and that appears to work.

Every time I try to upgrade, it works locally, but fails in CI (github-actions).

Hi @cg-roling, how did you set the CYPRESS_INTERNAL_BROWSER_CONNECT_TIMEOU variable as setting it in Cypress.config.js or to the cypress run API does not seem to be working?