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.

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.

×
2 answers

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 1.2.3.4/32 md5

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

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.

Submit an Answer