Middleware Issues in Next.js Using Drizzle, Supabase, and NextAuth

Hi everyone! Is there anyone here who has successfully implemented middleware with Drizzle, Supabase, and NextAuth? I'm using Next.js.

I initially encountered this error: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme). However, after deleting and reinstalling the Postgres package, this error has disappeared.

Now, during login, I'm facing this issue:

[auth][error] JWTSessionError: Read more at https://errors.authjs.dev#jwtsessionerror
[auth][cause]: Error: The edge runtime does not support Node.js 'net' module.

Is it not possible to use Next.js, Drizzle, Supabase, and NextAuth in an edge environment within middleware? What am I doing wrong? My code is visible in the pictures. Thanks in advance for the help!
auth.png
middlewarev2.png
db.index.ts.png
drizzle-config.png
schema.ts.png
Authentication for the Web
Was this page helpful?