Skip to content
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

Cypress 9.0.0 + Node 17.1 (Win 11) Crashes #18914

Closed
JamShady opened this issue Nov 15, 2021 · 14 comments · Fixed by #19094
Closed

Cypress 9.0.0 + Node 17.1 (Win 11) Crashes #18914

JamShady opened this issue Nov 15, 2021 · 14 comments · Fixed by #19094
Assignees

Comments

@JamShady
Copy link

JamShady commented Nov 15, 2021

Current behavior

Setup:

  • Windows 11
  • Node/NPM installed via Windows Binary Zip (64bit) into a predefined folder, included in the PATH so npm, etc, can be called from anywhere
  • Cypress installed as completely vanilla (i.e. npx cypress cache clear && npx cypress install && npx cypress open) - no other config or setup changes at all

When I use Cypress 9.0.0 and Node 17.1 (i.e. latest versions), Cypress opens up and displays the sample tests, but clicking any one of them results in the following error (non-important folder names redacted for privacy):

Title: Error running plugin

Message: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file ([appDir]\cypress\plugins\index.js)

Stack trace:

Error: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`[appDir]\cypress\plugins\index.js`)
    at Object.get (C:\Users\[user]\AppData\Local\Cypress\Cache\9.0.0\Cypress\resources\app\packages\server\lib\errors.js:1043:15)
    at EventEmitter.handleError (C:\Users\[user]\AppData\Local\Cypress\Cache\9.0.0\Cypress\resources\app\packages\server\lib\plugins\index.js:189:20)
    at EventEmitter.emit (node:events:394:28)
    at ChildProcess.<anonymous> (C:\Users\[user]\AppData\Local\Cypress\Cache\9.0.0\Cypress\resources\app\packages\server\lib\plugins\util.js:19:22)
    at ChildProcess.emit (node:events:394:28)
    at emit (node:internal/child_process:920:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

If I downgrade either/both to Cypress 8.7, or Node 16.13 (LTS version), then everything works fine and as expected, i.e.

  • Cypress 8.7 + Node 17.1 works
  • Cypress 9.0 + Node 16.13 works
  • Cypress 8.7 + Node 16.13 works

Desired behavior

Cypress 9.0 should run as expected with Node 17.1

Test code to reproduce

No test code required, it'll fail running the examples

Cypress Version

9.0.0

Other

No response

@jennifer-shehane
Copy link
Member

What is the code that you're running in your plugins file? It sounds like the code you are executing in that file may be incompatible with Node 17.1+.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Nov 15, 2021
@JamShady
Copy link
Author

JamShady commented Nov 15, 2021

As stated, literally nothing. It's a completely clean, vanilla, virgin, [insert any other applicable adjective] install of Cypress.

The file contents are literally:

// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
 * @type {Cypress.PluginConfig}
 */
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
  // `on` is used to hook into various events Cypress emits
  // `config` is the resolved Cypress config
}

@dan-kirberger
Copy link

dan-kirberger commented Nov 15, 2021

Same thing here (on mac), good point about it being limited to Node 17 only. We had the same issue in our apps when moving to node 17 (not cypress related).

You'll need (I added this on the terminal before launching cypress):

NODE_OPTIONS=--openssl-legacy-provider

I found that here when troubleshooting our local app building issue: webpack/webpack#14532

Whatever is happening under the hood in Cypress is due to this same underlying ssl change in node 17 I guess? Adding that environment variable fixed Cypress 9 for me on node 17.

At the very least, could this underlying error be bubbled up for us? Something is swallowing it.

@inqom-visma-qa
Copy link

inqom-visma-qa commented Nov 16, 2021

Same here

Windows10 / Cypress9.0.0 / Node17.0.1

@gustawx
Copy link

gustawx commented Nov 17, 2021

I have the same problem.

As above:
Windows 10 / Cypress 9.0.0 / Node 17.0.1

@mateuszmichna
Copy link

Same here. Vanilla install of Cypress 9.0.0 + node 17.0.1.

Can't run any (even dummy) test, because of this error.

Downgrading Cypress to 8.7.0 resolved that issue.

@cypress-bot cypress-bot bot added stage: backlog and removed stage: needs information Not enough info to reproduce the issue labels Nov 19, 2021
@Krisell
Copy link

Krisell commented Nov 23, 2021

Same problem for us on macOS and Node.js 17.1.0 with Cypress 9.0.0 and 9.1.0.
Solved by setting NODE_OPTIONS=--openssl-legacy-provider

@BlueWinds
Copy link
Contributor

BlueWinds commented Nov 23, 2021

As another temporary workaround, you can also set "nodeVersion": "bundled" in your cypress config - this will cause the plugins process to be executed under node 16, bundled with cypress, which doesn't show the error.

With that said, these are just workarounds, and I'm tracking down the root cause now.

@BlueWinds
Copy link
Contributor

BlueWinds commented Nov 23, 2021

Ok, so looking into the issue with cypress + node 17, it appears the following:

  • Node17 updated to OpenSSL 3.0, which now throws errors when you try to use obsolete hashing functions.
  • Webpack <5.61 rely on the builtin node cypto module for md4 hashes. They've fixed it in 5.61, but have no intention of backporting to webpack 4.
  • Cypress currently uses Webpack 4.44.2, and updating is a fairly major project. We'll have to do it eventually, but it's not an immediate solution.

Adding NODE_OPTIONS=--openssl-legacy-provider when we spawn the plugins process fixes this under node 17, but it also breaks node 16 - which means I need to query the node version before launching the plugin process and only add it for node 17+. Not terrible, just still working through it.

Anyway, these are just today's research notes. The workarounds remain the same - set "nodeVersion": "bundled", launch node with NODE_OPTIONS=--openssl-legacy-provider, or use node 16.

@fugazi
Copy link

fugazi commented Nov 24, 2021

I am facing with the same error with Cypress 9.1.0.
which file should I add "nodeVersion": "bundled" ? I don't know as long as cypress.json or package.json
Thanks!!

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: needs review The PR code is done & tested, needs review stage: work in progress labels Nov 24, 2021
@BlueWinds
Copy link
Contributor

I am facing with the same error with Cypress 9.1.0. which file should I add "nodeVersion": "bundled" ? I don't know as long as cypress.json or package.json Thanks!!

In cypress.json.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Nov 24, 2021
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Dec 1, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 2, 2021

The code for this is done in cypress-io/cypress#19094, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Dec 2, 2021
@BlueWinds
Copy link
Contributor

This should go out early next week in the 9.1.1 patch release.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 4, 2021

Released in 9.1.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v9.1.1, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants