cannot connect to database at postgres.railway.internal
yaneq
PROOP

a year ago

i am trying to connect my nestjs api with typeorm to a postgres server in the same project. the postgres PGHOST variable is postgres.railway.internal.

I tried to set this value in the variables of the nestjs api but on deploy i get the following error:

RUN yarn run migration:run:
at GetAddrInfoReqWrap.onlookup as oncomplete {errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'postgres.railway.internal'

Do i need to do anything else to let the api access the pghost?

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

4 Replies

brody
EMPLOYEE

a year ago

Do you get that error during build?


yaneq
PROOP

a year ago

Yes


yaneq
PROOP

a year ago

seems to be the same issue as https://help.railway.app/questions/cannot-connect-to-internal-database-url-e3b15293

i am using the public host url now and it works, but still something you might wanna look into to as its confusing to new users.


brody
EMPLOYEE

a year ago

The private network is not available during build, you would need to do whatever you are doing with the database during the runtime before starting your application.


Loading...