Need hep to fix error on route protection by customizing the middleware in NextAuth.
Answered
Ghostman posted this in #help-forum
GhostmanOP
Hi there,
When I try Middleware Route Protection in my Next.js NextAuth with Drizzle, I got errors like followings.
Here is my middleware.ts file
FYI: I'm using next14.1.3, next-auth 5.0.0-beta.15
If I remove middleware.ts file from my project, it's working fine.
I tried several solutions but could not solve this problem. Please help me ðŸ™
When I try Middleware Route Protection in my Next.js NextAuth with Drizzle, I got errors like followings.
cloudflare:sockets
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
Import trace for requested module:
cloudflare:sockets
./node_modules/postgres/cf/polyfills.js
./node_modules/postgres/cf/src/index.js
./database/index.ts
./auth.tsHere is my middleware.ts file
export { auth as middleware } from './auth';
export const config = {
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
};FYI: I'm using next14.1.3, next-auth 5.0.0-beta.15
If I remove middleware.ts file from my project, it's working fine.
I tried several solutions but could not solve this problem. Please help me ðŸ™
Answered by averydelusionalperson
This looks similar to this: https://github.com/vercel/next.js/discussions/50177
9 Replies
This looks similar to this: https://github.com/vercel/next.js/discussions/50177
Answer
Hey @Ghostman, did you found the solution?
GhostmanOP
Yes, I found it
so, can you close this thread, by marking your message as solution. if my messages didn't help.
GhostmanOP
I found it from https://github.com/vercel/next.js/discussions/50177
Thank you
your welcome, so can you mark the message as solution.
Original message was deleted
🫡