Next.js · browser console
PrismaClient is unable to run in this browser environment
Error: PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in `Chrome`).What it means
A Client Component imports your database client (often through lib/db.ts). Database code can only run on the server.
Common causes
- A "use client" component imports db from @/lib/db
- A shared file exports both db queries and client helpers
How to fix it
- Query the database in a Server Component or Server Action and pass the rows down as plain objects
- Add import "server-only" to lib/db.ts so the build fails early next time
import "server-only";
import { PrismaClient } from "@prisma/client";
export const db = new PrismaClient();Prompt for Cursor or Claude Code
Prisma is being bundled into the browser. Find which "use client" file imports the database client, move the query into a Server Component or Server Action, and add import "server-only" to the db module.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Next.js error fixer.
next: skip the next one
Skip the setup. The VibeBoot SaaS Starter gives you auth, Stripe and a database already wired on Next.js 16.4.3, with AGENTS.md and .cursor/rules that keep your agent on the Next.js 16 conventions. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Next.js errors
- useState / useEffect in a Server Component
- Event handlers cannot be passed to Client Component props
- Functions cannot be passed directly to Client Components
- Only plain objects can be passed to Client Components
- "use client" must be placed before other expressions
- export "metadata" from a "use client" page
$ fixed it? get the next one first
New fixes for what AI agents break, by email.
When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.