-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: ct testing support for node 17+ #21430
Changes from 2 commits
8d88b3b
495cc81
9c548dc
0b9b011
986c177
0654882
56ddea8
de551f7
d8ff77e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
"private": true, | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "gulp build", | ||
"build": "cross-env NODE_OPTIONS=\"$(node ../../scripts/use-legacy-openssl.js)\" gulp build", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work in Windows? IDK how the command substitution is handled cross-platform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point I'll give it a test! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't work on Windows, changed to running webpack in a child process so the env variables could be manipulated more easily |
||
"build-prod": "yarn build", | ||
"clean": "gulp clean", | ||
"clean-deps": "rimraf node_modules", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// https://github.com/cypress-io/cypress/issues/18914 | ||
// Node 17+ ships with OpenSSL 3 by default, so we may need the option | ||
// --openssl-legacy-provider so that webpack@4 can use the legacy MD4 hash | ||
// function. This option doesn't exist on Node <17 or when it is built | ||
// against OpenSSL 1, so we have to detect Node's major version and check | ||
// which version of OpenSSL it was built against before spawning the process. | ||
// | ||
// Can be removed once the webpack version is upgraded to >= 5.61, | ||
// which no longer relies on Node's builtin crypto.hash function. | ||
|
||
const semver = require('semver') | ||
|
||
let opts = process.env.NODE_OPTIONS || '' | ||
|
||
if (process.versions && semver.satisfies(process.versions.node, '>=17.0.0') && semver.satisfies(process.versions.openssl, '>=3', { includePrerelease: true })) { | ||
opts = `${opts} --openssl-legacy-provider` | ||
} | ||
|
||
// eslint-disable-next-line no-console | ||
console.log(opts) | ||
ZachJW34 marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, we should never use
'localhost'
in the App due to issues like this. We've even had users with an incorrectlocalhost
entry in/etc/hosts
, which causes mind boggling issues.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was absolutely baffled as to what was going on until I stumbled upon the issues I listed above.