4 hours ago
Hi, i am facing the challenge of getting my database to connected, it get stuck at attempting to connect to database and when it finish running i see the error message : connection terminated unexpectedly. please help me out
Attachments
Pinned Solution
3 hours ago
At this point I'd recreate a new Postgres instance, and delete the old one (don't delete the volume).
Then, drag the old volume onto the new service to swap volumes, and redeploy.
10 Replies
4 hours ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • about 4 hours ago
4 hours ago
no errors
4 hours ago
Try reloading the page, accessing the dashboard from a different device/network, or redeploying the database.
4 hours ago
ok, i have just done both and i get this last log :
Starting Container
Attachments
4 hours ago
i redeployed, restarted and also used a different network to access the dashboard
valentine387
ok, i have just done both and i get this last log :  Starting Container
4 hours ago
Are you able to access your database via a DB client (eg, Datagrip) through the public URL?
3 hours ago
No, I get "server closed the connection unexpectedly" when connecting via psql or DataGrip-style clients through the public proxy URL (DATABASE_PUBLIC_URL). I also can't connect via Railway's own in-browser Console (psql not found there) or via internal DATABASE_URL from inside my app's own Railway console (ECONNREFUSED). The Database tab in Railway's UI itself also shows "Connection terminated unexpectedly" when trying to connect via SSH.
3 hours ago
The command psql wasn't a thing when you ran it in the console tab in the Postgres service?
3 hours ago
Correct, when I open the Postgres service's Console tab and run psql $DATABASE_URL`, it returns: bash: psql: command not found
This happens even though I'm in the Postgres service's own console (not the app's). So I haven't been able to use psql from anywhere, not from the Postgres console, not from my local Mac terminal via the public proxy (which gives "connection terminated unexpectedly" / ECONNRESET instead), and not via railway connect Postgres from the CLI (same ECONNRESET).
3 hours ago
At this point I'd recreate a new Postgres instance, and delete the old one (don't delete the volume).
Then, drag the old volume onto the new service to swap volumes, and redeploy.
Status changed to Solved passos • about 1 hour ago
