Importing and using bcrypt in [...nextauth].ts throws a @mapbox error - app dir #6835
Replies: 5 comments
-
Also, ran into a compile failure while using mongoose as well.
ran into this while following https://next-auth.js.org/adapters/mongodb with brcypt. |
Beta Was this translation helpful? Give feedback.
-
I am having the same issue:
|
Beta Was this translation helpful? Give feedback.
-
I ran into same issue but using bcryptjs instead of bcrypt fixed mine. I think you should try that. |
Beta Was this translation helpful? Give feedback.
-
I've switched from bcrypt to bcryptjs, and everything is functioning properly. |
Beta Was this translation helpful? Give feedback.
-
After trying a few times, I got bcrypt to work with auth.js v5.0.0-beta.17. The trick is to use Make sure to have the auth.ts file within {...authConfig + providers}, and it'll work perfectly with bcrypt. Check out an example here:: https://github.com/ezeparziale/quark/blob/main/src/auth.ts |
Beta Was this translation helpful? Give feedback.
-
Environment
"bcrypt": "^5.1.0",
"next": "13.2.1",
"next-auth": "4.19.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Reproduction URL
https://github.com/DomicaCode/next-auth-example-app-dir
Describe the issue
Using bcrypt in [...nextauth].ts creates an error. The error specifically in question:
I think just importing it causes the issue, I've quickly reproduced it by using bcrypt in the
callbacks
.How to reproduce
Import and use
bcrypt
in [...nextauth].tsExpected behavior
Beta Was this translation helpful? Give feedback.
All reactions