Error using database_url variable
andreiprado
HOBBYOP

3 months ago

I`m trying to connect in my database, but my service is warning the same message always: etaddrinfo ENOTFOUND postgres.railway.internal.

How can i fix this? I`ve already tried everything i know.

When i use the DATABASE_PUBLIC_URL it works. But is this the right way to do it?

Thanks

$10 Bounty

4 Replies

Railway
BOT

3 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


gabsong
FREE

2 months ago

I don't think it's the right way to do it. You should not have to go through the public internet to access a database or infra that is internal to your application. I'm having a similar issue due to my app framework requiring DB access at build time. Hope you can get an answer for your problem as well.


modeoc
HOBBY

2 months ago

got this same problem


andrewgxp
FREE

2 months ago

Since it works on the public URL, I wonder if you're running into the one of the caveats of private networking when attempting to connect to postgres.railway.internal via internal DNS:

You will need to bind to a IPv6 port to receive traffic on the private network.

We don't support IPv4 private networking

Private networking is not available during the build phase

Can you check over the requirements for communicating over the private network and double check requisites are being met?

You should be able to use private networking with Postgres by setting the connection string like in this example using port 5432:

postgresql://postgres:password@postgres.railway.internal:5432/railway

How are you setting the connection string now? And what method are you using to deploy Postgres?

@gabsong, it sounds like you're also running into these caveats, as private networking is not available during build phase.


Loading...