Open tyronen opened 4 years ago
For more information on this error, see: https://github.com/brianc/node-postgres/issues/2009
Indicating the right SSL certificate using the ?sslrootcert=...
option should work, but it's kind of finicky to get it to work. I had success on Node 12 doing this, but on Node 14 not so much.
Since we're using a connection string, we can't just add rejectUnauthorized: false
(though you could try it with ?rejectUnauthorized=0
or similar, I suppose).
I recently raised this PR against pg-connection-string
to allow for parsing ?sslmode=no-verify
, but I'm not sure if it's released yet: https://github.com/brianc/node-postgres/pull/2345
Another option is to disable Node's TLS validation; e.g.:
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
https://stackoverflow.com/a/21961005/141284
Ultimately this is an issue between the pg
module, your Node version, your server's trusted SSL certificates, and your database server. gatsby-source-pg has very little say in the matter.
Summary
I'd like to connect to a Postgres instance running in Heroku.
Additional context
I use Heroku's DATABASE_URL environment variable, with the suffix
?ssl=1
in myconnectionString
. When I rungatsby develop
I get this error: