Next.js Discord

Discord Forum

PrismaClient is not configured to run in Edge Runtime

Unanswered
West African Crocodile posted this in #help-forum
Open in Discord
West African CrocodileOP
I'm building an app in NextJS 14 with Prisma as the ORM and using Clerk Middleware for aunthentication. This app also needs to expose an API end point which would accept REST API requests authenticated by an 'x-api-key'. The middleware would intercept this request and lookup the user based on the 'x-api-key'. I'm using Prisma client to make query to the DB and return the user.
When I try to run the curl request, I get the following error.

Although the solution is clear on using different drivers for edge runtime. I was wondering if there are any better solutions to this? Has anyone else faced such an issue.

One solution suggested in reddit forums was to expose an API endpoint in the Backend use a
fetch
call to get the user details. I'm a newbie to NextJS and have worked on Java/Golang before, so probably looking for a solution to something similar.

Was wondering if anyone else faced this problem and how did they solve it?

unhandledRejection: Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters

1 Reply

Crucian carp
Hello, I've got the same issue. How did you resolve it without having to instsall specific driver adapters ?