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.2.1 + Node 17.1 (Win 11) Fails/Errors When Attempting Any Test #19712

Closed
JamShady opened this issue Jan 14, 2022 · 14 comments · Fixed by #19977
Closed

Cypress 9.2.1 + Node 17.1 (Win 11) Fails/Errors When Attempting Any Test #19712

JamShady opened this issue Jan 14, 2022 · 14 comments · Fixed by #19977
Assignees

Comments

@JamShady
Copy link

Current behavior

On a brand new, vanilla install, when attempting to run any test (in this case, one of the included spec files), Cypress opens the browser, and then immediately fails as follows:
image

The error is: Error: error:0308010C:digital envelope routines::unsupported

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 (`D:\Web\basekit\cypress\plugins\index.js`)
    at Object.get (C:\Users\[user]\AppData\Local\Cypress\Cache\9.2.1\Cypress\resources\app\packages\server\lib\errors.js:1043:15)
    at EventEmitter.handleError (C:\Users\[user]\AppData\Local\Cypress\Cache\9.2.1\Cypress\resources\app\packages\server\lib\plugins\index.js:210:20)
    at EventEmitter.emit (node:events:394:28)
    at ChildProcess.<anonymous> (C:\Users\[user]\AppData\Local\Cypress\Cache\9.2.1\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)

Setting "nodeVersion": "bundled" in the config resolves this error, but this wasn't required previously

Desired behavior

The test should run

Test code to reproduce

Vanilla fresh install and the bundled test specs

Cypress Version

9.2.1

Other

May be related to #18914 - that's where I got the 'fix' from

@GentlemanHal
Copy link

I get the same error on MacOS 12.0.1 and Node 17.2.0.
Cypress 9.2.0 works fine, so I've just switched back to that for now.

@emilyrohrbough
Copy link
Member

@JamShady / @GentlemanHal What node version are you using & what version of openSSL was the node version built with? Can you please share you OS, terminal and details on how you are running cypress & any logs? Looking for details to reproduce the issue.

This change was released in 9.2.1 to try and fix some issue observed with Cypress & Node 17....

@Krisell
Copy link

Krisell commented Jan 17, 2022

I'm facing the same problem with macOS 12.1, Node 17.3.1, Cypress 9.2.1 and OpenSSL 3.0.1+quic. It can easily be resolved with NODE_OPTIONS=--openssl-legacy-provider.

Regarding the fix mentioned above, is that only for new project in some starter code? I have an existing project, updated to Cypress 9.2.1, and I don't see that code anywhere. Searching for openssl-legacy-provider in node_modules/cypress gives no hits. Or did I miss something in an upgrade guide?

@GentlemanHal
Copy link

GentlemanHal commented Jan 17, 2022

  • macOS 12.0.1
  • Node 17.2.0 (installed via nvm)
  • GNU bash, version 5.1.8(1)-release (x86_64-apple-darwin19.6.0)

what version of openSSL was the node version built with?

I wasn't sure how to do this, searching I found this command node -e "console.log(process.versions)" | grep openssl and that returns:

  • 3.0.0+quic

I got the error in an open source project I work on, so you can see all the files and how it is run at https://github.com/build-canaries/nevergreen

This is the log I get when running Cypress 9.2.1:

The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`false`)

 Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at makeSourceMapAndFinish (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-loader/dist/index.js:58:5)
    at successLoader (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-loader/dist/index.js:40:5)
    at Object.loader (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-loader/dist/index.js:23:5)
    at LOADER_EXECUTION (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Users/cm/Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/node_modules/graceful-fs/graceful-fs.js:123:16

@emilyrohrbough
Copy link
Member

Regarding the fix mentioned above, is that only for new project in some starter code?

This change should be applied when Cypress starts the plugin process. This change won't be found in node_modules/cypress because the cypress npm module only included the CLI. It will install the Cypress binary onto your machine. Running cypress verify will show the install location of the binary.

@Krisell
Copy link

Krisell commented Jan 18, 2022

Regarding the fix mentioned above, is that only for new project in some starter code?

This change should be applied when Cypress starts the plugin process. This change won't be found in node_modules/cypress because the cypress npm module only included the CLI. It will install the Cypress binary onto your machine. Running cypress verify will show the install location of the binary.

Thanks for the additional information! I realised that was probably the case, and with your help I could locate the code referenced above. Then my question/problem remains, I still have to add the NODE_OPTIONS manually, even though ny node version is >= 17.0.0 and the OpenSSL version does not begin with 1..

@emilyrohrbough
Copy link
Member

@Krisell Are you able to check if the --openssl-legacy-provider flag is being applied from with the node options passed to the child process from within the binary? Seems like it should be based on the information you've provided.

@Krisell
Copy link

Krisell commented Jan 18, 2022

If I run npx cypress run on 9.2.1 i get the familiar error Error: error:0308010C:digital envelope routines::unsupported. However if I manually run it as NODE_OPTIONS=--openssl-legacy-provider npx cypress run, it all works.

By adding some logging in the Cypress code I was able to see that process.versions.openssl does return 1.1.1 when cypress is running, however the same code in a plain JS file returns 3.0.0+quic. The node versions are the same in both cases.

What could cause this discrepancy? If this is likely to be a setup issue on my device, you don't have to spend more time debugging this.

@Oaky78
Copy link

Oaky78 commented Jan 19, 2022

I had the same problem. You have to install latest stable Node version 16.13.2. Then it works.
nvm install --lts

@sodatea
Copy link
Contributor

sodatea commented Jan 19, 2022

It fails in my GitHub Actions, too: https://github.com/vuejs/create-vue/runs/4864811524?check_suite_focus=true#step:8:73
Node.js 17, Ubuntu latest, Cypress 9.3.1

@JamShady
Copy link
Author

@JamShady / @GentlemanHal What node version are you using & what version of openSSL was the node version built with? Can you please share you OS, terminal and details on how you are running cypress & any logs? Looking for details to reproduce the issue.

OS: Windows 11
Node 17.1.0
Terminal: PowerShell 7.2.1

Opening Cypress by npx cypress open in the project directory

Just upgraded to Cypress 9.3.1 and Node 17.4, the problem remains. I don't know about the OpenSSL version, I downloaded the Windows 64bit portable (.zip) from here: https://nodejs.org/en/download/current/

@fugazi
Copy link

fugazi commented Jan 24, 2022

Any news to this issue? It continues broking my tests.

This was referenced Jan 25, 2022
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: backlog labels Jan 31, 2022
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jan 31, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 31, 2022

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

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 31, 2022

Released in 9.4.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jan 31, 2022
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.

7 participants