-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of ?sslmode=require
and ssl
property in pg.Pool
#3355
Comments
Use the
Example: node-postgres/packages/pg-connection-string/test/parse.js Lines 220 to 226 in 373093d
|
You can also go directly to import parseConnectionString from 'pg-connection-string';
const pgConfig = parseConnectionString(env.DATABASE_URL);
if (env.DATABASE_CA_CERT) {
pgConfig.ssl.ca = env.DATABASE_CA_CERT;
}
const pool = new pg.Pool(pgConfig); Whether you choose to use |
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=require
query parameter at the end.I experience the error:
It seems like the query param
sslmode=require
completely overrides thessl
property setting. I confirmed this by removing thesslmode=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?The text was updated successfully, but these errors were encountered: