-
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
Unable to resolve "@aws-crypto/sha256-js" from generateCodeVerifier.ts (random) #13024
Comments
Hey, @Juliakas 👋. Just based on the comment about you recently upgrading from v5 to v6, could you see if deleting your if that doesn't let me know and we will dig into this deeper! Thanks. |
Hi @cwomack. That does seem to help, under my node_modules I have @aws-crypto/sha256-js installed with 5.2.0 version. So for my use case this seems to help, appreaciate it! But on a side note, just curious was this intended to not include this dependency for a package that is using it and assume consumer app will resolve it correctly when installing? In my dependency tree there are a lot of @aws-crypto/sha256-js@3.0.0 installations and I guess that version could be chosen to be installed in a first level of node_modules? |
@Juliakas, great to hear you're unblocked! As for the follow up question about the dependency not being included, the Hope this helps and I'll close this issue as resolved! |
@cwomack I'm getting a very similar error, also from
The package The core problem raised by this issue seems not to be solved. I would suggest explicitly adding |
Who has still this error, i resolved this by installing @aws-crypto/sha256-js . Could you update the doc ? |
@tobz1000 and @stealth90, appreciate the follow up comments here. Reopening this issue and referencing the associated PR #13950 that's been made to address it. This is indeed still an issue, as the package is consumed here... but is not declared as a dependency here. However, it IS declared in the core package as a dependency, which this core package is declared as a peer to the auth package (see here). |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify CLI
Environment information
Describe the bug
When loading in mobile app using expo development build I am receiving and error message on startup:
Unable to resolve "@aws-crypto/sha256-js" from "node_modules\@aws-amplify\auth\src\providers\cognito\utils\oauth\generateCodeVerifier.ts"
.When checking
package.json
in @aws-amplify/auth there is no direct (or at the very least peer) dependency of @aws-crypto/sha256-js. It is only referenced indirectly via my-app -> aws-amplify -> @aws-amplify/core -> @aws-crypto/sha256-js.I am using npm 8.3.2 and my package-lock in this scenario did not resolve @aws-crypto/sha256-js as a direct dependency under node_modules/* - instead it is scattered under various aws-amplify packages, but not under @aws-amplify/auth.
I did manage to work around this by including @aws-crypto/sha256-js directly inside my own package.json, but that doesn't feel right, as now I will have to make sure it is always up to date to whatever version aws packages are supposed to be using. Am I just missing something here or does aws package in question need to specify a direct dependency if it is using it in its own code?
Expected behavior
Package is resolved properly and I can open app without errors.
Reproduction steps
npm install @aws-amplify/react-native @react-native-community/netinfo @react-native-async-storage/async-storage react-native-get-random-values
(versions included in enviroment information section, other packages may be important as well for influencing package-lock.json).Code Snippet
For my full package-lock.json - see this: https://stackblitz.com/edit/stackblitz-starters-57xee1?file=package-lock.json . Also includes package.json
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
OnePlus 6
Mobile Operating System
Android 11
Mobile Browser
Edge
Mobile Browser Version
121
Additional information and screenshots
This all started happening after I migrated from V5 to V6, but I also updated a bunch of other packages so that might have influenced my package-lock.json.
The text was updated successfully, but these errors were encountered: