Using Prisma in Middleware
Unanswered
Marchy posted this in #help-forum
MarchyOP
I'm trying to use Prisma within middleware to do a token check for a basic auth example, however I'm getting this error:
I was expecting to be able to access the database within middleware, but would I just need to move that portion out to a route handler?
Error: PrismaClient is unable to be run in the browser.I was expecting to be able to access the database within middleware, but would I just need to move that portion out to a route handler?
3 Replies
Giant panda
Middleware always runs on Edge. Prisma isn’t supported there.
Chub mackerel
there's prisma/client/edge package you can use