Strip sslmode from connection string to fix TLS override

Newer pg versions treat sslmode=require as verify-full, overriding
the programmatic ssl.rejectUnauthorized=false config. Strip sslmode
from the URL and handle SSL entirely via the Pool ssl option.

Made-with: Cursor
This commit is contained in:
Randall Stillwell 2026-04-16 00:08:47 -05:00
parent fd3e1ba150
commit 19270ef6ec

View file

@ -7,8 +7,10 @@ const globalForPrisma = globalThis as unknown as {
};
function createPrismaClient() {
const url = new URL(process.env.DATABASE_URL!);
url.searchParams.delete("sslmode");
const pool = new pg.Pool({
connectionString: process.env.DATABASE_URL,
connectionString: url.toString(),
max: 5,
ssl: { rejectUnauthorized: false },
});