cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.

Home Page:https://cypress.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

JamShady opened this issue · comments

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

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.

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

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?

  • 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

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.

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

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

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.

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

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 / @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/

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

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.

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.