Unable to Connect to PostgreSQL

I am attempting to connect my current render application to my new PostgreSQL database, but am having some issues. I attempted connecting via the internal URL connection provided on the database page and breaking it up into the various data parts (DB, USER, PASSWORD, HOST, etc.) but both are throwing errors.

From my local machine I was able to connect to the remote database via the external connection URL.

Below are some screenshots from my latest error and setup:

Screenshot 2023-07-19 at 3.29.16 PM

dbConfig.HOST appears to be unset, because it’s still trying to connect to 127.0.0.1, but Postgres is not run on the same machine as the Web Service/Private Service/etc.

Additionally dialetOptions: is misspelled. (And that might be the source of the problem too.)

Good catch on the misspelling, unfortunately didn’t resolve the issue. The HOST looks to be getting set correctly from the environment variable.

Let try the other way, using the internal database URL provided by postgreSQL. Below is the setup and error:

Screenshot 2023-07-19 at 7.14.54 PM

The error is confusing to me because I can assure you the DB_URI_INTERNAL environment variable is a string and everywhere I have looked online has this Sequelize instance configuration.

I do have dotenv installed in my server.js file so that is not missing. I have also done console logs of the process.env.DB_URI_INTERNAL value and it appears correctly, so the “received undefined” in the error is also throwing me off.

Hi there,

So we can look into this further, can you please open a support ticket from our dashboard?

Regards,

Keith
Render Support, UTC+10 :australia:

The solution to my issue was embarrassingly simple. I added an environment variable in my web service setup for DB_URI_INTERNAL set to the internal connection URL.

1 Like

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