no pg_hba.conf entry for host \"IP-ADDRESS", user \"username\", database \"database\", SSL off

I am trying to access my managed postgreSQL database from my node.js app which is hosted in Google Cloud. I am getting the above error. I am using pg-promise in my node.js app. How to go about it? Please advise.


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

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.

Hello, I believe that you are getting a deny on the connection as the client is not in the pg-hba-conf file, there should be a way to authorize networks/ or a similar thing on from your database provider.

You need to whitelist the IP you are making the request from in /etc/postgresql/9.5/main/pg_hba.conf (be 9.5 the version of you postgresql installation). An example:

host all all md5

Where md5 is the trust method, 32 the network mask and the request IP