cypress: Cannot read properties of undefined (reading 'isServer')

Current behavior

Since upgrading to Cypress 10, we are getting crashes in our CI with the following error:

Cannot read properties of undefined (reading 'isServer')
TypeError: Cannot read properties of undefined (reading 'isServer')
    at TLSWrap.onerror (node:_tls_wrap:411:27)
  cypress:network:agent addRequest called { isHttps: true, href: 'https://api.cypress.io/exceptions' } +49ms
  cypress:network:agent got family { family: 4, href: 'https://api.cypress.io/exceptions' } +0ms
  cypress:server:browsers killing browser process +9s
  cypress:server:browsers:chrome closing remote interface client +9s
  cypress:server:browsers:chrome closing chrome +0ms
  cypress:cli child event fired { event: 'exit', code: 1, signal: null } +2m
  cypress:cli Stopping Xvfb +2m

This is happening almost ever run we do. Hover we are running in 30 machines parallel, and the most I’ve seen is two machines fail in the same test run.

I found an issue https://github.com/nodejs/node/issues/41501 and PR https://github.com/nodejs/node/pull/41523 that relate to this error above, which seems to have been fixed in Node v16.15.0.

I set up for our tests to run in a custom container image today that is using Node v16.15.1, so I could see if that helps. However I’ve now realised that cypress has an internal version of node which is being used, v16.13.2 which still has this bug in it from Node.

Desired behavior

Ideal if should not being crashing when this error happens.

As this is an issue with how node is happening an error internally, there is probably some other error happening, but it’s breaking before we can see what that is.

Test code to reproduce

Not sure how to reproduce this as I can’t work out what is causing the issue.

In https://github.com/nodejs/node/issues/41501 they weren’t able to workout what the exact cause was, other than something wrong with the network somewhere.

Cypress Version

10.1.0

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 18
  • Comments: 36 (8 by maintainers)

Most upvoted comments

Good news. Upgraded today to 10.4.0. All seems resolved so far. 10.4 included the update to electron, which doesn’t include a version of node where this is an issue anymore.

I am having a similar issue. For me, It occurs when upgrading from 9.6.1 -> 9.7.0 (electron 100). For my test suite, I can consistently reproduce this issue locally on my mac and in aws codebuild CI docker image - both of which use node v16.14.0. I am not parallelizing tests. What is interesting is that it always fails on the 2nd test in my test suite (the first test passes successfully), but it isn’t specific to the actual 2nd test spec. I can move test specs around, comment/delete specs, and it still consistently fails on the 2nd spec that runs.

TypeError: Cannot read properties of undefined (reading 'isServer')
    at TLSWrap.onerror (node:_tls_wrap:411:27)

We are discussing as a team to figure out prioritizing an Electron 19.x upgrade to resolve issues like this, as well as one thats are related.

I have the same issue on 10.1.0

Is there anything I can do to fix this or do we just have to wait?

I am going to close this since it should be resolved with the electron bump in #22775 which was released in 10.4.0. If this continues to be an issue for some, please let us know so we can discuss and possibly reopen the issue.

Facing the same issue on:

  • Windows 11
  • Cypress 10.3.1
  • Chrome 99 (headless)
  • Node v16.14.0 Any workaround?

we are releasing 10.2.0 today, which bumps the electron version to 18.3.0. Unfortunately, the internal node version I believe is still fixed to v16.13.2, so I do not expect this release to fix this issue. This issue likely won’t be resolved until we do a major electron version bump.

We had to downgrade to cypress 9.6.1 (which also caused a chain of other downgrades which is very inconvenient). Hopefully this isn’t too long in getting fixed or we will need a more involved workaround to prevent this in our CI.

I rolled back to version 9 pretty much after constantly running into this on every suite run.

Until cypress is based a newer version of electron. This is just gonna keep happening.

Just experienced this with 10.3 on macOS 12.4.

Has there been any solution for this error? The same thing happens to me in github actions

I have the same behaviour locally and on ci : cypress version : “9.7.0”

mesmo problema aqui, executar local irá forçar o fechamento do Windows 11 cypress 10.1.0 navegador Chrome v102 nó v16.15.1

Captura de tela 2022-06-18 092934

conseguiu resolver o problema?

Resolved for me after upgrading to 10.4.0 😃

I guess it comes down to this being caused by network level errors and the way they are handled.

There must be something in my setup that errors often enough to crash each test suite run.

We are using node 16 and npm 8, running only a few scripts seems to work, but if I execute the entire suite, it always breaks. Is it suggestable to downgrade the cypress version?

Hi everyone, anyway to circumvent this instead of downgrading to cypress to 9.6.1 ? Thanks in advance

same issue here, run local will force-close windows 11 cypress 10.1.0 browser Chrome v102 node v16.15.1

Screenshot 2022-06-18 092934

same issue here after migrating to v10

 Cypress:        10.0.3
 Browser:        Custom Chromium 90 (headless)
 Node Version:   v12.22.12

I have been able to reproduce the error in the repo @devhid has shared locally. It’s doesn’t happen every time for me, but it happens often enough.

I’m having the same issue:

Cannot read properties of undefined (reading 'isServer')
TypeError: Cannot read properties of undefined (reading 'isServer')
    at TLSWrap.onerror (node:_tls_wrap:411:27)

POST /logging_client_events 200 95.593 ms - -
The Test Runner unexpectedly exited via a exit event with signal SIGABRT

Please search Cypress documentation for possible solutions:

https://on.cypress.io

Check if there is a GitHub issue describing this crash:

https://github.com/cypress-io/cypress/issues

Consider opening a new issue.

----------

Platform: darwin-x64 (21.4.0)
Cypress Version: 10.1.0

This is a (fairly) minimal reproducible example: https://github.com/devhid/cypress-v10-issue

In my case, I’m trying to run Lighthouse on some sample websites for both mobile and desktop viewports, but I get the mentioned error at the end of the test run.

My Lighthouse tests run fine on Cypress v9.6.0:

❯ npx cypress --version    
Cypress package version: 9.6.0
Cypress binary version: 9.6.0
Electron version: 15.5.1
Bundled Node version: 16.5.0

But not on Cypress v10.1.0:

❯ npx cypress --version
Cypress package version: 10.1.0
Cypress binary version: 10.1.0
Electron version: 18.0.4
Bundled Node version: 16.13.2

I’m using the following Node / NPM versions:

❯ node --version  
v16.14.2

❯ npm --version   
8.10.0

Steps:

  1. npm i
  2. npx cypress open
  3. Run lighthouse.cy.js