Prisma · runtime error
Environment variable not found: DATABASE_URL
error: Environment variable not found: DATABASE_URL.
--> schema.prisma:8
|
7 | provider = "postgresql"
8 | url = env("DATABASE_URL")What it means
schema.prisma reads the connection string from env("DATABASE_URL") and it isn't set where this command or server is running.
Common causes
- The agent put DATABASE_URL in .env.local: Next.js reads it, but the Prisma 6 CLI only loads .env
- It's set locally but not in the Vercel (or other host) project settings
- It's set for Production but not Preview deployments
How to fix it
- For local dev, put DATABASE_URL in .env (keep it in .gitignore)
- Add it in your host's environment variables for every environment that builds or runs the app, then redeploy
- Check the spelling: the name in env("…") must match exactly
Prompt for Cursor or Claude Code
Prisma can't find DATABASE_URL. Check which env files exist: the Prisma 6 CLI only reads .env, not .env.local. Put DATABASE_URL in .env for local dev, make sure .env is gitignored, and list the hosting environment variables I still need to set. Don't print the secret value.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Prisma error fixer.
next: skip the next one
Skip the setup. The VibeBoot SaaS Starter ships a ready prisma/schema.prisma and one Prisma client in src/lib/db.ts (SQLite by default, Postgres by changing the provider), plus auth and Stripe on Next.js 16.4.3. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Prisma errors
- @prisma/client did not initialize yet
- Property 'x' does not exist on type 'PrismaClient'
- Prisma has detected that this project was built on Vercel
- PrismaClient is unable to run in this browser environment
- PrismaClient is not configured to run in Edge Runtime
- The URL must start with the protocol postgresql://
$ 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.