2 months ago
Im running a nextjs application in a STAGING environment that builds successfully - however once it deploys it cannot connect to my STAGING postgres DB that I'm running.
NextJS app keeps saying this:
Error: P1001: Can't reach database server at postgres.railway.internal:5432
Please make sure your database server is running at postgres.railway.internal:5432.
error: script "start" exited with code 1
$ bun x prisma migrate deploy && bun --bun next start
Loaded Prisma config from prisma.config.ts.
Prisma schema loaded from prisma/schema.prisma.
Datasource "db": PostgreSQL database "railway", schemas "auth, public" at "postgres.railway.internal:5432"
Error: P1001: Can't reach database server at postgres.railway.internal:5432
Please make sure your database server is running at postgres.railway.internal:5432.
error: script "start" exited with code 1
The postgres logs dont show any attempt at an incoming connection. Everything has been upgraded to metal also - I'm about to try the public Database URL to see if that works, however shouldnt the private one be fine?
Ive tried reference variable ${{Postgres.DATABASE_URL}} and hard coding the string.
1 Replies
2 months ago
Hey there!
Different projects are network isolated from each other. What you want to do is deploy your Redis and Postgres instances in the same project as your application, then you'll see both of them on the canvas together. Then you should use private networking to connect them.
- Echo
Status changed to Awaiting User Response Railway • about 2 months ago
Status changed to Solved kyasui • about 2 months ago