TLS Error with Prisma 7 + Better Auth on Vercel (Self-Signed Certificate Issue)

Hey everyone, I'm running into a TLS issue and want to see if anyone here has any guidance.

I'm using Better Auth with Next.js (App Router) + Prisma 7 and everything works perfectly when I'm on localhost with a local PostgreSQL database.
But as soon as I switch to an external cloud PostgreSQL instance (for production on Vercel), I start getting a TLS error.

Here’s the log from Vercel:

[Better Auth]: PrismaClientKnownRequestError Error [PrismaClientKnownRequestError]: 
Invalid `prisma.verification.create()` invocation:

Error opening a TLS connection: self-signed certificate in certificate chain
    at async Object.create (...)
    at async createWithHooks (...)
    at async Object.createVerificationValue (...) {
  code: 'P1011',
  meta: [Object],
  clientVersion: '7.0.0'
}


It only happens on Vercel with the external DB — not locally.
Has anyone faced this with Prisma 7 + @prisma/adapter-pg or Better Auth?
Do I need extra TLS config in
prisma.config.ts
or something specific for the PG adapter?

Here are the relevant package versions:

"@prisma/adapter-pg": "^7.0.0",
"@prisma/client": "^7.0.0",
"prisma": "^7.0.0",
"better-auth": "^1.4.1",
"pg": "^8.16.3",
"next": "^15.5.6",
"react": "^19.2.0"

If anyone has suggestions on how to fix the self-signed certificate issue with a cloud PostgreSQL provider, I'd appreciate the help.
Was this page helpful?