Replies: 1 comment
-
Type Script declarations in this library expose what the underlying driver supports. And if |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was troubleshooting a failing connecting to my Google Postgres instance and found that I need to include a
host
property in my SSL configuration. TheISSLConfig
interface doesn't have this property.Since documenting how to connect with each and every service out there isn't likely, I'm posting this as reference for and to be improved by others.
This is for those that require connecting to their GCP Cloud SQL Postgres instance via SSL certs instead of Cloud Proxy (e.g. for serverless environments).
In certain libraries that use
node-postgres
under the hood (pg-promise
, for instance), thessl
object used to configure the DB connection doesn't expose all the underlyingnode
properties by default.If you created your GCP PostgreSQL instance before January 2023, the
host
property is required, in the following format, alongside thekey
,cert
andca
properties, otherwise theERR_TLS_CERT_ALTNAME_INVALID
error is thrown.Note that the
host
syntax is not theproject:region:instance
format that you'll find the GCP SQL Cloud Console. It's justproject:instance
.I can't speak to how the implementation would be for instances created after January 2023, but there's talk of changes in
node
itself and changes in Google's approach as well.The following thread has been my reference and talks about implementations of instances after January 2023 as well: brianc/node-postgres-docs#79 (comment)
Anything to add or clarify is welcome!
Beta Was this translation helpful? Give feedback.
All reactions