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?
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!
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 https://node-postgres.com/features/ssl
change your connection string to use ssl and sslMode= require. In Java:
postgresql://testserver.dev.net:1234/test?ssl=true&sslmode=require
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.