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

Module not found: Error: Can't resolve 'crypto' #159

Closed
RobbieTheWagner opened this issue Dec 13, 2020 · 10 comments
Closed

Module not found: Error: Can't resolve 'crypto' #159

RobbieTheWagner opened this issue Dec 13, 2020 · 10 comments

Comments

@RobbieTheWagner
Copy link
Member

WARNING in ./node_modules/amazon-cognito-identity-js/es/utils/cryptoSecureRandomInt.js
Module not found: Error: Can't resolve 'crypto' in '/Users/rwwagner90/shipshape/swach/node_modules/amazon-cognito-identity-js/es/utils'
 @ ./node_modules/amazon-cognito-identity-js/es/utils/cryptoSecureRandomInt.js
 @ ./node_modules/amazon-cognito-identity-js/es/utils/WordArray.js
 @ ./node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js
 @ ./node_modules/amazon-cognito-identity-js/es/index.js
 @ /private/var/folders/2p/61j5p9d56ln49n5wf1jc5q3r0000gn/T/broccoli-2336901HrgXZ0Ik4L/cache-546-bundler/staging/tests.js
 @ multi /private/var/folders/2p/61j5p9d56ln49n5wf1jc5q3r0000gn/T/broccoli-2336901HrgXZ0Ik4L/cache-546-bundler/staging/l.js /private/var/folders/2p/61j5p9d56ln49n5wf1jc5q3r0000gn/T/broccoli-2336901HrgXZ0Ik4

Any ideas how to resolve this?

@paulcwatts
Copy link
Collaborator

I haven't seen that error. What version of Ember is it? Or of amplify?

@RobbieTheWagner
Copy link
Member Author

@paulcwatts if you install this addon in an app and run it, you'll get the error in your terminal. We're on latest Ember, but I don't think the Ember version has any bearing on this.

@paulcwatts
Copy link
Collaborator

Sorry, I should have time to look this (and the PR) today.

@paulcwatts
Copy link
Collaborator

I merged the PR (thank you!), but unfortunately it doesn't clear the warning. The only thing I can think is some issue with the newer version of amazon-cognito-identity-js, since it doesn't happen in my apps and I'm on 4.3 of that library. Perhaps try pinning that library?

@RobbieTheWagner
Copy link
Member Author

@paulcwatts I think this might fix it #161

If I understand the problem correctly, crypto was built into node, and webpack polyfilled it automatically before, but does not anymore. This should add back the polyfill.

@paulcwatts
Copy link
Collaborator

Wow, great find!

@RobbieTheWagner
Copy link
Member Author

Thanks! Please let me know if it works.

@RobbieTheWagner
Copy link
Member Author

@paulcwatts have you tested to see if this fix worked?

@paulcwatts
Copy link
Collaborator

I did, it seems to work -- I merged your PR and released a new version.

@RobbieTheWagner
Copy link
Member Author

@paulcwatts awesome, glad to hear it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants