backend cannot reach Postgres over private networking (Connection refused)
testuchunmaxsus
PROOP

an hour ago

Project: RetailFlowAI (production). Service "backend" cannot connect to "Postgres" over private networking.

  • backend (FastAPI + asyncpg) -> postgres.railway.internal:5432 => ConnectionRefusedError: [Errno 111] Connection refused (every attempt).
  • Same backend reaches redis.railway.internal fine (Redis ok). MinIO internal host also fails. So it's specific to Postgres (and MinIO) private DNS/routing.
  • Postgres is Online; logs show "database system is ready to accept connections". Its public TCP proxy works from outside — the DB is healthy.
  • Already tried (none fixed): disabled Serverless on Postgres + backend; redeployed both several times; DATABASE_URL = ${{Postgres.DATABASE_URL}} (postgres.railway.internal).
  • /readiness: {"postgres":"error","minio":"error","redis":"ok"}.

Looks like internal DNS/private-networking for the Postgres service is broken while redis.railway.internal works. Please check private networking for Postgres in this project. Blocking production. Thanks.

$20 Bounty

2 Replies

Railway
BOT

an hour ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 1 hour ago


Are they in the same environment?


0x5b62656e5d

Are they in the same environment?

testuchunmaxsus
PROOP

an hour ago

Yes — backend and Postgres are in the same project (RetailFlowAI) and the same environment (production). All 4 services (backend, web, Postgres, Redis) are in production. The backend reaches redis.railway.internal in that same environment fine, but postgres.railway.internal gives Connection refused — so it looks specific to the Postgres service's private networking, not an environment mismatch.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...