3 months ago
Hi,
After migrating my project to a Railway Workspace, my API service started crashing in a loop.
Before the migration, everything was working correctly.
Current behavior
- Build succeeds normally.
- The service starts.
- During startup, it runs
npx prisma migrate deploy. - Prisma throws the following error:
Error: P1001: Can't reach database server at `postgres.railway.internal:5432`- The container exits.
- Railway restarts it.
- The crash loop continues.
Stack
- Node.js API
- Prisma ORM
- Railway Postgres (same project)
- DATABASE_URL is set as a reference to Postgres
Environment configuration
DATABASE_URL is configured as:
${{Postgres.DATABASE_URL}}The Postgres service shows:
- Deployment Online
- Required Variables OK
No changes were made to the database service itself — only the repository was migrated into a workspace.
Even after rolling back to a previously working commit, the issue persists.
Additional details
- The API and Postgres are in the same Railway project.
- The start command is:
npx prisma migrate deploy && node dist/src/server.jsIt appears that after migrating to a workspace, the internal hostname postgres.railway.internal is no longer reachable from the service.
Could this be related to networking changes when moving to a workspace?
Pinned Solution
3 months ago
It’s working now. I didn’t change anything — after multiple restarts since yesterday, the service suddenly started normally. Not sure what happened, but everything is stable now. Thanks everyone!
4 Replies
3 months ago
Is the private networking URL for your Postgres service postgres.railway.internal or Postgres.railway.internal? If it's capitalized, edit it and set it to lowercase. (View this in your Postgres networking settings)
3 months ago
Is your postgres healthy and not just "online"? (Check the logs for anything too)
3 months ago
It’s working now. I didn’t change anything — after multiple restarts since yesterday, the service suddenly started normally. Not sure what happened, but everything is stable now. Thanks everyone!
Status changed to Solved brody • 3 months ago
