You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hashing will be needed, and now we're adding hashing in auth.ts, and importing auth from that file in middleware.ts.
The problem is that, auth.ts is importing hashing related stuff, and when imported to middleware.ts, it'll cause an error:
Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
Import trace for requested module:
node:crypto
./node_modules/.pnpm/argon2@0.43.0/node_modules/argon2/argon2.cjs
./src/auth.ts
⨯ node:crypto
Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
Import trace for requested module:
node:crypto
This is because middleware.ts uses edge runtime, and argon2 can't be used in edge runtime.
why is it mentioned in the documentation like that
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
So In the docs, it suggests to create a middleware: https://authjs.dev/getting-started/installation
That is OK, but the thing is, if someone is implementing Credentials auth: https://authjs.dev/getting-started/authentication/credentials
Hashing will be needed, and now we're adding hashing in
auth.ts
, and importingauth
from that file inmiddleware.ts
.The problem is that,
auth.ts
is importing hashing related stuff, and when imported tomiddleware.ts
, it'll cause an error:This is because
middleware.ts
uses edge runtime, and argon2 can't be used in edge runtime.why is it mentioned in the documentation like that
Beta Was this translation helpful? Give feedback.
All reactions