Nestjs Boilerplate Unable To Connect Internal ipv6 domain
google
PROOP

10 months ago

I am using nestjs boilerplate to run my projects but I am not able to use postgres inernal DATABASE_URL. I have to use PUBLIC_DATABASE_URL to connect and run my migrations.
https://github.com/brocoders/nestjs-boilerplate

I tried to add '::' on app linten as parameter but still doesnt work.
```
await app.listen(configService.getOrThrow('app.port', { infer: true }), '::');
```

railway.toml
```
[build] builder = "nixpacks" buildCommand = "npm run build" [build.nixpacksPlan.phases.install] cmds = ["npm config delete production", "npm ci --omit=dev"] [deploy] preDeployCommand = ["npm run migration:run && npm run seed:run:relational"] startCommand = "npm run start:prod" restartPolicyType = "ON_FAILURE" restartPolicyMaxRetries = 5
````

I am getting
```
Error: getaddrinfo ENOTFOUND postgres.railway.internal

at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) {

errno: -3008,

code: 'ENOTFOUND',

syscall: 'getaddrinfo',

hostname: 'postgres.railway.internal'

}
```

Solved

5 Replies

chandrika
EMPLOYEE

10 months ago

Hey, have you checked out guide on deploying a NestJS app? Deploy a NestJS App


Status changed to Awaiting User Response Railway 10 months ago


google
PROOP

10 months ago

Yes, I did, but I don’t see any helpful solutions to fix my problem.


Status changed to Awaiting Railway Response Railway 10 months ago


chandrika
EMPLOYEE

10 months ago

Could you please double check your DATABASE_URL variable is configured with the correct credentials?


Status changed to Awaiting User Response Railway 10 months ago


google
PROOP

10 months ago

Credentials look correct. When I use DATABASE_PUBLIC_URL it's working.

// This env variables works
DATABASE_HOST="switchback.proxy.rlwy.net"

DATABASE_KEY=""

DATABASE_MAX_CONNECTIONS="100"

DATABASE_NAME="${{Postgres.PGDATABASE}}"

DATABASE_PASSWORD="${{Postgres.PGPASSWORD}}"

DATABASE_PORT="58286"

DATABASE_REJECT_UNAUTHORIZED="false"

DATABASE_SSL_ENABLED="false"

DATABASE_SYNCHRONIZE="false"

DATABASE_TYPE="postgres"

DATABASE_URL="${{Postgres.DATABASE_PUBLIC_URL}}"

DATABASE_USERNAME="${{Postgres.PGUSER}}"

// This env variables doesn't works
DATABASE_HOST="${{Postgres.PGHOST}}"

DATABASE_KEY=""

DATABASE_MAX_CONNECTIONS="100"

DATABASE_NAME="${{Postgres.PGDATABASE}}"

DATABASE_PASSWORD="${{Postgres.PGPASSWORD}}"

DATABASE_PORT="${{Postgres.PGPORT}}"

DATABASE_REJECT_UNAUTHORIZED="false"

DATABASE_SSL_ENABLED="false"

DATABASE_SYNCHRONIZE="false"

DATABASE_TYPE="postgres"

DATABASE_URL="${{Postgres.DATABASE_URL}}"

DATABASE_USERNAME="${{Postgres.PGUSER}}"


Status changed to Awaiting Railway Response Railway 10 months ago


jake
EMPLOYEE

10 months ago

You're using it in the build. You can't use the private network in the build


Status changed to Awaiting User Response Railway 10 months ago


Status changed to Solved google 10 months ago


Loading...