Node / Express ECONNREFUSED issue

Hi people,

Bit of a full stack noob here, feeling little out of my depth on a work project i’ve taken on. I’ve created an order form with an API and a front-end client using PostgreSQL, Express, Node.js & React. The psql database is hosted on siteground (thats what my bosses wanted because they already pay for hosting) and I’ve tried to upload the API part of the app here, my front end is still being ran locally for the time being and I am using s to connect the queries.

I’ve managed to deploy it without errors, and it seems to be up and running but when I try and make any requests with either postman or through the browser Im being met with the error in logs and the request times out with no response.

connect ECONNREFUSED 127.0.0.1:5432

I’ve looked at similar threads in this forum and I haven’t been able to find anything that helps my specific issue. I feel like it could be something to do with pg pool or the environment variables not being configured correctly, I know my psql server works fine because when i run my express API locally it works fine, and I have whitelisted the outgoing IP’s from my render deploy. I don’t really know how to troubleshoot this. I have tried using a pool with hardcoded variables just for testing purposes and it still doesn’t want to play ball.

If you have any advice or need additional information to help please let me know. Thanks!

Hey Nick,

connect ECONNREFUSED 127.0.0.1:5432

That is showing me that your code is trying to connect to a Postgres running on localhost so it’s not connecting to the pql database that you already have in place.

This is something that you’ll need to fix in your code,

Regards,

John B

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.