I have the following code snippet
const pool = new pg.Pool({
connectionString: env.DATABASE_URL,
ssl: env.DATABASE_CA_CERT
? {
ca: env.DATABASE_CA_CERT,
rejectUnauthorized: true,
}
: undefined,
});
seems like a pretty standard setup. I have downloaded CA_CERT from DigitalOcean managed database product.
I copied the connection string which includes the ?sslmode=require query parameter at the end.
I experience the error:
Error: self-signed certificate in certificate chain
It seems like the query param sslmode=require completely overrides the ssl property setting. I confirmed this by removing the sslmode=require and the pool got connected normally.
Can anyone explain a little bit deeper on why this is the case? I might miss some stuff, but if sslmode=require is set on the connection string, how should one set the CA cert for the connection pool?
I have the following code snippet
seems like a pretty standard setup. I have downloaded CA_CERT from DigitalOcean managed database product.
I copied the connection string which includes the
?sslmode=requirequery parameter at the end.I experience the error:
It seems like the query param
sslmode=requirecompletely overrides thesslproperty setting. I confirmed this by removing thesslmode=requireand the pool got connected normally.Can anyone explain a little bit deeper on why this is the case? I might miss some stuff, but if
sslmode=requireis set on the connection string, how should one set the CA cert for the connection pool?