Cannot connect to the postgres instance via private network

andyperlitch
HOBBY

10 months ago

I have a node server in my tcf-server instance, and a postgres instance (tcf-pg). I followed the instructions to create an env variable which references the private network database url:

DATABASE_URL = ${{tcf-pg.DATABASE_URL}}

The failure indicates that it is receiving the value properly, however the connection is failing:

1.321 Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"

1.404

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

1.404

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

View Deploy details

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

3 Replies

10 months ago

The private network is not available during build, please do the database actions during runtime before starting your app.


brody

The private network is not available during build, please do the database actions during runtime before starting your app.

alekzv9
PRO

4 months ago

Hey @brody, prisma connects to the database during build if you use the feature "typedSql", is there a workaround this?


alekzv9

Hey @brody, prisma connects to the database during build if you use the feature "typedSql", is there a workaround this?

alekzv9
PRO

4 months ago

Solved my issue. Hope this helps but during build command I used the public database url and then when the app is running I connect using the private


Cannot connect to the postgres instance via private network - Railway Help Station