I'm encountering a frustrating problem connecting to Heroku Postgres using psql and in psycopg2, on sslmode=require.
When connecting with the next examples on debian (python 2.7.13) I'm encountering the same problem of
psql: SSL error: certificate verify failed
psql:
psql "host=<MyHost> sslmode=require" --port=5432 --username=<MyUser> --password
Psycopg2:
import psycopg2
db_url = "postgres://User:Pwd@Host:5432/DB?sslmode=require"
psycopg2.connect(db_url)
I tried to change the postgresql.conf and pg_hba.conf as described here:
PSQL: SSL error: unknown protocol
No Luck.
My versions:
psycopg2=-2.6.2
OpenSSL=1.1.0j 20 Nov 2018
postgres=9.6
Ok. I figured out that in my system, somehow there is a root.crt file in the ~/postgresql dir. The .crt file made the whole problem (it wasn't certificated to Heroku) and when I deleted it, the connection worked.
FYI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With