QuestionI'm using Prisma with PostgreSQL on AWS RDS (connecting via RDS Proxy) using an image based off I've dug around and it seems the Prisma default of How to reproduce (optional)Expected behavior (optional)No response Information about Prisma Schema, Client Queries and Environment (optional)generator client {
provider = "prisma-client"
output = "../src/lib/generated/prisma"
engineType = "client"
runtime = "nodejs"
moduleFormat = "esm"
generatedFileExtension = "ts"
importFileExtension = "ts"
previewFeatures = ["fullTextSearchPostgres"]
}
// db.server.ts
import { PrismaPg } from '@prisma/adapter-pg'
import { Prisma, PrismaClient } from '@/lib/generated/prisma/client'
import logger from './logger'
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
let prisma: PrismaClient | null
if (process.env.NODE_ENV === 'production') {
// @ts-ignore
prisma = new PrismaClient({
adapter,
log: [
{
emit: 'event',
level: 'query',
},
{
emit: 'event',
level: 'error',
},
{
emit: 'event',
level: 'warn',
},
],
})
} else {
// @ts-ignore: TODO: type def for global
if (!global.prisma) {
// @ts-ignore
global.prisma = new PrismaClient({ adapter })
}
// @ts-ignore
prisma = global.prisma
}
// exported
|
Replies: 3 comments
|
Hi @joekrall! The node-postgres (pg) driver, which powers the new Rust-free Prisma ORM, does not implement the same semantics for sslmode=prefer as the libpq (PostgreSQL native) client. In node-postgres, The error you encountered is likely a result of the The Rust-based Prisma engine (used before the Rust-free/driver adapter approach) also enforced SSL by default when connecting to AWS RDS, but it appears to have been more permissive or had different defaults regarding certificate validation. |
|
Hi, As we have not heard back from you, we are closing this discussion to keep our discussions organized. Feel free to start a new discussion if this remains relevant. Thank you for being part of the community! |
Hi @joekrall!
The node-postgres (pg) driver, which powers the new Rust-free Prisma ORM, does not implement the same semantics for sslmode=prefer as the libpq (PostgreSQL native) client. In node-postgres,
sslmode=preferis effectively treated assslmode=require, meaning it will attempt an SSL connection and fail if the server does not support SSL, rather than falling back to a non-SSL connection. See this comment on a related issue.The error you encountered is likely a result of the
pgdriver not falling back to a non-SSL connection when the server requires SSL, and the connection string does not explicitly set sslmode to require or no-verify.The Rust-based Prisma engine (used before the…