2 years 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] (node:dns:107:26) {errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'postgres.railway.internal'
Do i need to do anything else to let the api access the pghost?
ⓘ Deployment information is only viewable by project members and Railway employees.
4 Replies
2 years ago
Yes
2 years 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.
2 years 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.