a year ago
Hello. I deployed a new PostgreSQL + NodeJS project today. And it failed during the build phase.
According to the build log, it failed to resolve the postgres.railway.internal
.
0.938 > fastify-react-sample@1.0.0 db:migrate
0.938 > node db/migrate.mjs
0.938
1.043 Error: getaddrinfo ENOTFOUND postgres.railway.internal
1.043 at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
1.043 errno: -3008,
1.043 code: 'ENOTFOUND',
1.043 syscall: 'getaddrinfo',
1.043 hostname: 'postgres.railway.internal'
1.043 }
I know this is an expected behavior. Private network can not be used in the build phase.
https://docs.railway.app/reference/private-networking#caveats
However, my question is why the reference variable ${{Postgres.PGHOST}}
was translated into the private domain.
I have another working project. And in the project, ${{Postgres.PGHOST}}
is translated to the public sub-domain under .rlwy.net
.
Is this because of a recent change on Railway or am I missing something?
1 Replies
a year ago
I know this is an expected behavior. Private network can not be used in the build phase.
It can with the new builder that you enable in the service settings!
However, my question is why the reference variable
${{Postgres.PGHOST}}
was translated into the private domain.
To try and prevent people from using the public domain and racking up egress charges, see Changelog #0195.
I have another working project. And in the project,
${{Postgres.PGHOST}}
is translated to the public sub-domain under.rlwy.net
.
That database was deployed before the changes mentioned in the changelog.