Can't reach database server in private network.
jrfidellis
HOBBYOP

2 years ago

I'm getting this error in my Next.js app when it tries to reach the database.

I have the Next.js app and the Postgres DB in the same Railway service.

The Next.js app references the database url using a Variable Reference: ${{Postgres.DATABASE_URL}}

This is the error message I'm getting:

PrismaClientInitializationError:
Invalid `prisma.chat.findMany()` invocation:

Can't reach database server at `postgres.railway.internal`:`5432`

Please make sure your database server is running at `postgres.railway.internal`:`5432`.

I have already tried using a custom start script: `sleep 3 && npm start`

And I have tried using the `ENABLE_ALPINE_PRIVATE_NETWORKING` env variable in my Next.js app.

It didn't fix the issue.

5 Replies

brody
EMPLOYEE

2 years ago

Looks like you have solved the problem!


jrfidellis
HOBBYOP

2 years ago

I have not solved the problem! What I did was use the Public URL to make my app usable, but I would prefer to use the private network to avoid egress fees


jrfidellis
HOBBYOP

a year ago

Should I expect to get any help with this?


brody
EMPLOYEE

a year ago

Deeply sorry about letting your message go unnoticed.

I will look at your project when I'm back at the computer.


brody
EMPLOYEE

a year ago

Hey, I've looked into your project and don't see anything wrong, so please remove the sleep 3 and alpine variable as those are not needed with the v2 runtime, then switch back to the private network.


Loading...