NextAuth 5> with PrismaPostgres & Edge Middleware
Hi there, has anyone figured out how to get Prisma Postgres working with NextAuth 5? I am using accelerate
And got authentication working fine when I am not running edge middleware. In the (outdated) documentation using accelerate is suggested as an alternative to the adapters so I kind of figured everything would work.
But in my middleware.ts
Will cause a lot of errors
It worked fine when I was using Neon Postgres with the official adapters and I would hate to move back lol.
Things I've tried
- use canary next with nodeMiddleware flags
- move prisma instantiation into auth.js file
This removes the mention of auth.ts in the logs but still errors on @/lib/prisma.ts
Any tips?
2 Replies
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into
#ask-ai for a quick spin!Also: the official example (from prisma github) uses the Next Auth CredentialsProvider without a middleware file. And (i think by default) a JWT strategy which does not call the database; might be mistaken on this though.