Error library

Prisma Client on the edge runtime / bundled for the browser

Prisma Client was bundled into client code or run in an edge runtime that cannot open normal database connections. Keep Prisma in Node.js server code (export const runtime = 'nodejs'), or use an edge-compatible driver adapter or Prisma Postgres/Accelerate if you must run at the edge.

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

Cause: A route, middleware, or client component imports Prisma while running on the Edge runtime or in the browser.

How to fix it

  1. Remove export const runtime = 'edge' from routes that use Prisma (Node.js is Vercel's default).
  2. Don't import Prisma in client components or middleware; call it from server code only.
  3. For edge, use a supported driver adapter (e.g. Neon serverless) or Prisma Postgres/Accelerate.
  4. Run prisma generate in the build step and redeploy.

Example

Illustrative example, not from a customer project.

- export const runtime = 'edge'
+ export const runtime = 'nodejs'
  import { prisma } from '@/lib/prisma'

FAQ

Can I use `pg` on Vercel Edge?

Prisma's docs note node-postgres is not supported on Vercel Edge Functions.

Why does middleware trigger it?

Next.js middleware has historically run on the Edge runtime, so importing Prisma there hits this error.

QUICK FIX · $49 · THIS ERROR ONLY

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

One error, one root cause, fixed in your app. If it turns out bigger, we tell you before doing more, and your $49 is credited toward the fix, diagnosis or Launch Path if you book within 14 days. Fixing three? The 3-Error Pack is $119.

Bigger job: More than one auth or data issue? Auth & database security fix, from $400.

Built with Lovable, Bolt, Replit, Cursor or v0? See rescue by platform and the security checklist.

Check it yourself first, free

$49Fix this error