-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(core): resolve webcrypto from node:crypto for Node18 #13599
Conversation
Please ensure that this PR:
A repository administrator is required to review this change. |
ff3bc2a
to
4e5250f
Compare
4e5250f
to
d391fa0
Compare
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.
Looks good to me, few comments
packages/aws-amplify/package.json
Outdated
@@ -288,6 +288,9 @@ | |||
"devDependencies": { | |||
"typescript": "5.0.2" | |||
}, | |||
"engines": { |
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.
Sanity check: Any risk of breakage here? What happens in NPM & yarn if someone is using an older version?
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.
As adding the node version restriction is considered as a breaking change, removing it from this PR. When the library is used in a Node.js environment with version < 16, an error will be thrown as unable to resolve the Web crypto API.
@HuiSF Does this impact people who are using SSR? Does crypto change get used during token refresh? |
Hey @haverchuck , The Webcrypto APIs are not used within token refresh flows on the server side. On the server side of a SSR framework, Webcrypto API will be resolved from Node.js (it's already happening before this change with Node.js v20+). After this change, the Webcrypto API is resolvable with a Node.js version that provides Webcrypto. Currently, there is no Amplify server-side APIs consuming Webcrypto APIs. |
Description of changes
Issue #, if available
Description of how you validated changes
Checklist
yarn test
passesChecklist for repo maintainers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.