PrismaClientInitializationError: Can't reach database server
Quick answer
This means Prisma can't establish a connection to your database at all — usually a wrong `DATABASE_URL`, a paused/suspended Neon project, a missing `?sslmode=require`, or a firewall blocking the connection.
What causes this error
Prisma throws this before your query even runs — it means the TCP connection to the database itself failed, not a query problem. On Neon specifically, free-tier projects that have been idle can be auto-suspended, causing a delay or a failed first connection.
The Fix
- Double-check `DATABASE_URL` in your `.env` matches exactly what's in your Neon dashboard
- Make sure it ends with
?sslmode=require— Neon requires SSL - If using Neon's serverless driver, confirm you're using the pooled connection string (usually has
-poolerin the hostname) for serverless/edge environments - Run `npx prisma db pull` as a quick connectivity test — if that fails too, it's confirmed a connection issue, not a Prisma bug
Common causes / variations
- `.env` not loaded because you're running a script outside your normal dev server
- Copy-pasted connection string missing the password or database name
- Neon project auto-suspended after inactivity (free tier) — first request just needs a retry after a few seconds
Related errors
See also: @prisma/client did not initialize yet.
Was this fix helpful?
Comments
Loading comments...