Issue
I am trying to connect to my Heroku Postgres database and I am getting the following error:
error: no pg_hba.conf entry for host "XX.XXX.XXX.XX", user "userfoo", database "dbfoo", SSL off
Resolution
This error indicates that Heroku Postgres can't authenticate your connection to the database because it doesn't accept non-SSL (no pg_hba.conf entry for ... SSL off).
All Heroku Postgres production databases require using SSL connections to ensure that communications between applications and the database remain secure. If your client is not using SSL to connect to your database, you see these errors even if you're using the right credentials to connect to it.
Most PostgreSQL clients automatically connect using SSL (using sslmode=require or sslmode=prefer). If you see this error, ensure that your PostgreSQL client is configured to use SSL connections to the database.