"Widespread PostgreSQL connectivity issue - 'Connection terminated unexpectedly' across multiple projects"

beneditorafaella-del
HOBBYOP

a month ago

I'm facing two separate issues:

1. Railway PostgreSQL Connectivity Issue (Platform-wide)

• All 3 of my Railway projects show "Connection terminated unexpectedly"

• This appears to be a Railway infrastructure issue affecting PostgreSQL connectivity

• The connection timeout errors indicate network-level connectivity problems

2. API Routing Issue

• Routes are registering successfully (we see " Supplier routes registered successfully")

• But requests aren't reaching the Express middleware (no debug logs)

• This suggests the issue is at the Railway edge/proxy level

Why the API Routes Aren't Working:

The issue appears to be that Railway's edge proxy isn't routing requests to Express server properly. This could be:

• Railway edge caching issues

• Routing configuration problems

• Health check interference

My DATABASE_URL format: postgresql://postgres:xxx@nozomi.proxy.rlwy.net:16983/railway

Solved$10 Bounty

9 Replies

Railway
BOT

a month 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!


Railway

Hey there! We've found the following might help you get unblocked faster: - [🧵 SSL PostgreSQL connection `?sslmode=disable` safe?](https://station.railway.com/questions/ssl-postgre-sql-connection-sslmode-disa-ef4ca54b) - [🧵 posgres database issues.](https://station.railway.com/questions/posgres-database-issues-1f3f10b1) - [🧵 PostgreSQL Database Connection Issues - ECONNRESET Errors](https://station.railway.com/questions/postgre-sql-database-connection-issues-f19205f4) - [🧵 Postgres down? Can't connect to roundhouse.proxy.rlwy.net](https://station.railway.com/questions/postgres-down-can-t-connect-to-roundhou-89acc57f) If you find the answer from one of these, please let us know by solving the thread!

beneditorafaella-del
HOBBYOP

a month ago

I couldn't find answer


a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open ray-chen about 1 month ago


beneditorafaella-del
HOBBYOP

a month ago

Current Status Summary

What's Working:

• backend is deploying successfully to Railway

• The server is starting and registering routes properly

• Health checks are passing

What's Not Working:

1. API Routing: Requests to /api/* endpoints aren't reaching your Express app

2. Database Connection: Still having connectivity issues even with private network


beneditorafaella-del
HOBBYOP

a month ago

I can see some progress! Now it says "Database host: postgres.railway.internal" which confirms it's using the individual environment variables correctly. However, it's still getting an ENETUNREACH error, but this time it's a different IPv6 address.


beneditorafaella-del
HOBBYOP

a month ago

Database Progress

• Private Network: Successfully configured to use postgres.railway.internal

• Environment Variables: Individual DB vars are being used correctly

• SSL Configuration: Properly configured for private network (no SSL required)

Remaining Issues

1. Database Connectivity: Even the private network shows ENETUNREACH errors, suggesting Railway's internal DNS resolution or network routing is having issues

2. API Routing: Express routes are registering successfully but requests aren't reaching the middleware stack

My Recommendation

I'm experiencing both database and API routing issues that appear to be Railway infrastructure-related.


beneditorafaella-del

Current Status SummaryWhat's Working:• backend is deploying successfully to Railway• The server is starting and registering routes properly• Health checks are passingWhat's Not Working:1. API Routing: Requests to /api/* endpoints aren't reaching your Express app2. Database Connection: Still having connectivity issues even with private network

a month ago

Hey, have you tried redeploying the database? Furthermore, can you check if you have opted in for the IPv4 private networking feature flag which can be found at https://railway.com/account/feature-flags, it is best to opt out and redeploy your services if this is the case.


beneditorafaella-del
HOBBYOP

a month ago

Working Endpoints:

• GET /health - Health check

• GET /api/suppliers/all - Returns mock supplier data (exactly what needed for frontend testing!)

• GET /api/suppliers/test - Test endpoint confirming supplier routes work

Issues Remaining:

• Database connectivity still failing (PostgreSQL ENETUNREACH IPv6 issues)

• Some endpoints like /api/products and /api/auth/login returning "API endpoint not found"

• Railway appears to be running a hybrid version - not exactly server.js or server-simple.js


beneditorafaella-del

Working Endpoints:• GET /health - Health check• GET /api/suppliers/all - Returns mock supplier data (exactly what needed for frontend testing!)• GET /api/suppliers/test - Test endpoint confirming supplier routes workIssues Remaining:• Database connectivity still failing (PostgreSQL ENETUNREACH IPv6 issues)• Some endpoints like /api/products and /api/auth/login returning "API endpoint not found"• Railway appears to be running a hybrid version - not exactly server.js or server-simple.js

a month ago

I am not sure what "Railway appears to be running a hybrid version - not exactly server.js or server-simple.js" means, but can you confirm that you have done what I have suggested above? Additionally, you may check if the database is running at all, such as having an active deployment and being able to access the Database tab, which connects to your database via public networking, to confirm that this problem is isolated to private networking only.


beneditorafaella-del
HOBBYOP

a month ago

Just to update. The problem was solved by this:

1. Fixed Database Connection Issues - Railway PostgreSQL external connections were broken, now using reliable local PostgreSQL

  1. Set Up Local Development - PostgreSQL 14 running locally with stylemate database

3. Maintained Railway Production - production deployment will still use Railway's internal PostgreSQL

( Free local development + Railway production hosting)


Status changed to Solved uxuz about 1 month ago


Loading...