Closed alveshelio closed 3 days ago
It's because Next.js uses Edge runtime in middleware. (https://nextjs.org/docs/app/building-your-application/routing/middleware#runtime
The problem is writed in the docs. https://authjs.dev/guides/edge-compatibility#middleware
Thanks @Imunal.
Environment
Reproduction URL
https://github.com/parite-sciences/webapp-resources
Describe the issue
I'm working on a project with Authjs and I'm using Drizzle and SQLite with better-sqlite3 and when checking if the user is authenticated in the middleware with
auth
I'm getting this error:If I remove
auth
from the middleware then the error goes away.How to reproduce
pnpm install && pnpm dev
Expected behavior
I would expect to be able to check if the user is authenticated or not in the middleware.