I am not able to connect to my postgres db via public url
sukhsingh-95
PROOP

2 months ago

HOST: postgres-production-d3c5e.up.railway.app

DB: railway

Port: 5432

It shows connection time out errors.

psql -h postgres-production-d3c5e.up.railway.app -p 5432 -U postgres -d railway

psql: error: connection to server at "postgres-production-d3c5e.up.railway.app" (66.33.22.3), port 5432 failed: Operation timed out

Is the server running on that host and accepting TCP/IP connections?

I am able to connect to other postgres service that I have deployed in AWS RDS so the firewall is not restricting the access on port 5432.

Solved

4 Replies

Status changed to Awaiting Railway Response Railway 2 months ago


2 months ago

The domain you're using (postgres-production-d3c5e.up.railway.app) is an HTTP domain, not the TCP proxy domain used for database connections. To connect externally to Postgres, you need the TCP proxy domain and port found in your service's Variables tab under DATABASE_PUBLIC_URL. It will look something like shuttle.proxy.rlwy.net:12345, with a different host and port than what you're currently using.


Status changed to Awaiting User Response Railway 2 months ago


sukhsingh-95
PROOP

2 months ago

This is what I see postgresql://postgres:*******OPZhmvF*******@postgres-production-d3c5e.up.railway.app:5432/railway in DATABASE_PUBLIC_URL under variables


Status changed to Awaiting Railway Response Railway 2 months ago


sukhsingh-95
PROOP

2 months ago

I have deleted my old deployment. Creating a new one now.


2 months ago

  1. You're connecting to the HTTP endpoint of your Postgres service, which isn't supported and it shouldn't have a HTTP endpoint unless you manually configured it to do so
  2. You'll want to use the TCP Proxy (Public Networking > Connect to your service over TCP using a proxied domain and port)

Status changed to Awaiting User Response Railway 2 months ago


Status changed to Solved sukhsingh-95 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...