Open jrilez opened 4 months ago
I got the same error when use bcrypt in a middleware. (Next 14.2.3)
The same error occurs. To be honest solving all sorts of weird problems with the framework itself has made me exhausted before I even started actually coding work.
Here is a "solution". I found that the promise function is allowed in the middleware. Apparently, we can call an authentication endpoint via the fetch method. This "auth" endpoint will verify the credentials with the bcrypt module.
This clumsy solution fulfills the requirement and while not breaking the beautiful vase!
I got the same error when use bcrypt on async method.
My final solution
bcrypt
cannot be run in middleware.signin
method in the frontend.bcrypt
for authorizationsignin
method from @/auth
file in the backend.authorize
callback. Do not use bcrypt
to verify the passwordBasically, you need to do the authorization in your own backend, and ensure the credentials are valid before passing them to the authorize callback.
Verify canary release
Provide environment information
Which example does this report relate to?
next-learn/dashboard/starter-example/
What browser are you using? (if relevant)
Firefox 126.0.1
How are you deploying your application? (if relevant)
npm run dev
Describe the Bug
I have been following this guide, and in chapter 15, when setting
login-form.tsx
as a client component with"use client";
, I get the following error:I read of the same issue in Route Handlers Crash with bcrypt #46493 , so I even tried to add
serverComponentsExternalPackages
tonext.config.js
auth.ts
Expected Behavior
no response
To Reproduce
no response