PostgreSQL Database Connection Failure - "Connection terminated unexpectedly"
gonenha
PROOP

2 months ago

Hi Railway Support Team,

Our PostgreSQL database service in the DocsFlow project is showing "Connection terminated unexpectedly" and is unable to

accept connections.

Project Details:

- Service: PostgreSQL (Postgres DB)

- Status: Deployment Online, but Database Connection failing

- Error: "We are unable to connect to the database over the public network. Connection terminated unexpectedly"

- Impact: Both dependent services (docsflow-backend and meeting-recording-microservice) cannot connect

Troubleshooting Attempted:

- Tried internal connection: postgres.railway.internal:5432 (IPv6 ECONNREFUSED errors)

- Tried proxy connection: switchback.proxy.rlwy.net:25352 (timeout expired errors)

- Restarted the PostgreSQL service

- Verified DATABASE_URL environment variables are correctly set

- Increased connection timeouts to 120 seconds

The TCP Proxy is configured correctly on port 5432, and all required variables are set.
The issue appears to be with the PostgreSQL service itself, not our application configuration.

Could you please investigate this database connectivity issue?

Thank you for your assistance.

Best regards,

Gonen

Attachments

$30 Bounty

6 Replies

Railway
BOT

2 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


uxuz
MODERATOR

2 months ago

Hey, have you changed anything within the Postgres database and when did it start to happen?


gonenha
PROOP

2 months ago

We have NOT made any direct changes to the PostgreSQL database itself, We added migration scripts to the microservice startup process to create the clients table

 The migrations were attempting to run but kept failing with connection timeouts


gonenha
PROOP

2 months ago

We do have a backup from September 24, 2025.

The web application is still under development and doesn't have any real production data in the

database yet. So restoring from the backup wouldn't cause data loss issues.

However, before we restore, could you confirm:

1. Is the issue likely to be database corruption, or a Railway service/connectivity problem?

2. Would restoring the backup fix a "Connection terminated unexpectedly" error?

If you think the restore might help, we can proceed with it since there's no production data at risk.


gonenha
PROOP

2 months ago

???


gonenha

We do have a backup from September 24, 2025.The web application is still under development and doesn't have any real production data in thedatabase yet. So restoring from the backup wouldn't cause data loss issues.However, before we restore, could you confirm:1. Is the issue likely to be database corruption, or a Railway service/connectivity problem?2. Would restoring the backup fix a "Connection terminated unexpectedly" error?If you think the restore might help, we can proceed with it since there's no production data at risk.

uxuz
MODERATOR

2 months ago

Hey, sorry for the late response, attempting to restore the backup should be the best approach, if you are sure that you won't lose any data.


Loading...