I am using environment variables to connect to by database through a Node.js webapp. When a submit a request to my database I get a 504 Gateway Time-out error. I checked my pm2 logs, and I am getting the following error "no pg_hba.conf entry for host “<myIP>”, user “<myusername>”, database “<mydatabase>”, SSL off.
Here are my environment variables
PGUSER=<myusername> PGHOST=<myhost> PGPASSWORD=<mypassword> PGDATABASE=<mydatabase> PGPORT=<myport> PGSSLMODE=true NODE_ENV=production
All of those are copied from the connection parameters provided to me by digital ocean. The managed database is SSL = require, but when I change PGSSLMODE to =require, I get the following pm2 log error “self signed certificate in certificate chain”.
I also tried setting the connection string provided to me as the environmental variable connection: to see if that would work, but that gave me the following error “connect ECONNREFUSED 127.0.0.1:5432”. My digital ocean managed database is not 5432, which I know is the default Postgres port, so it makes me think that it isn’t seeing that environment variable.
Any help is appreciated, and please let me know if you need more context!
This textbox defaults to using Markdown to format your answer.
Click below to sign up and get $200 of credit to try our products over 60 days!