Cannot connect to PostgreSQL(also run on render)

Hi there,

I succeeded to run the server on your service(dataScraper, my website name). I used two databases, both of which were provided by you(PostgreSQL & Redis). However, once I deployed “dataScraper” on your service, I could no longer connect to PostgreSQL. Regarding PostgreSQL setting, I use your external URL in my nodejs, and it works fine on my local network. But after deploying(I change to an internal URL) it showed me
“Error: connect ECONNREFUSED
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
errno: -111,
syscall: ‘connect’,
address: ‘’,
port: 5432
For further information, I also set Access Control in PostgreSQL with my website’s “Static Outbound IP Addresses”. Is this action correct? What else could I do so that my website could connect to PostgreSQL? Thanks in advance for your reply.

My connection written in Nodejs


HI there,

Thanks for reaching out.

The error you shared, shows it’s trying to connect to, which wouldn’t be correct for a Render Postgres instance.

Please make sure the POSTGRESQL_EXTERNAL_URL is set correctly, and that all database connections in your code use those connection settings.

You don’t need to set access controls unless you want to access the database directly from outside of Render. If the service and database are in the same account & region, the “Internal Database URL” would work without having access controls enabled.

Kind regards


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