Postgres managed DB require pg_hba.conf

I have set up a managed postgres db v11.

I was provided with connection details. I can connect through pqsl client no problem.

However, when I want to connect a docker container to a database, I get the following error.

ERROR { error: no pg_hba.conf entry for host "host_ip", user "user_name", database "database_name", SSL off 
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11) 

I believe I have to update the pg_hba.conf file, however, I am unable to grant myself (the login user) a superuser role to even view the file or create a user who is a superuser

ERROR: must be superuser or a member of pg_read_all_settings to examine "hba_file" 

Since this is a managed service and I do not have access to the host, is it possible to access this file elsewhere?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I just got this error too, while trying to run a migration with Knex.js. I think the crucial problem is the “SSL off” part. If you notice, the connection string that DO provides has “sslmode=require”, so I’m assuming the server just won’t allow non-SSL connections even if you’re in the pg_hba.conf.

In my case, I was able to fix it by adding these lines to my knexfile.js, which force SSL mode on.

Make sure whatever client/library you’re using is respecting the SSL setting, and make sure it’s on.

Does anyone have a example for node-postgres to connect to managed postgres DB over SSL? I only can get hold of the ‘ca-certificate’ on cloud control panel but this doc asks for more