Postgres ECONNRESET / unable to connect using TCP Proxy
julientregoat
HOBBYOP

9 months ago

Hi there,

I've had a great experience with Railway so far, but I'm encountering one issue I can't seem to find a fix for.

Whenever I try to connect to my Postgres service via the TCP Proxy, it never connects.

I have tried using both psql and railway connect (which I guess uses psql under the hood) and get the same error:
```
psql: error: connection to server at "<redacted>" (<redacted>), port <redacted> failed: server closed the connection unexpectedly

This probably means the server terminated abnormally

before or while processing the request.
```

I am able to connect to the image via railway ssh but this doesn't help me if I'm trying to run migrations from my local computer. I imagine a hacky workaround could be to SSH into my backend service and install the required dependencies to migrate from that instance using private networking, but I don't love that idea and it's a bit restrictive.

It seems like other people have encountered this issue with Railway but no clear solution was found in my research other than to add a 3 second timeout, but not sure how that would work if I'm using a CLI that doesn't expose that as a configuration option.

Is there some reason the server would keep aborting the connection? Am I using the TCP proxy incorrectly?

Solved

5 Replies

itsrems
EMPLOYEE

9 months ago

Are you using DATABASE_PUBLIC_URL to connect ?


Status changed to Awaiting User Response Railway 9 months ago


julientregoat
HOBBYOP

9 months ago

yes I am! I’m using referenced variables for everything


Status changed to Awaiting Railway Response Railway 9 months ago


ray-chen
EMPLOYEE

9 months ago

That's odd. Are you able to try re-deploying the database? Was the TCP Proxy added manually?


Status changed to Awaiting User Response Railway 9 months ago


ray-chen

That's odd. Are you able to try re-deploying the database? Was the TCP Proxy added manually?

julientregoat
HOBBYOP

8 months ago

yes I added the TCP proxy manually. I am going to redeploy the database but this isn't viable in production, correct?


Status changed to Awaiting Railway Response Railway 8 months ago


brody
EMPLOYEE

8 months ago

Hello,

I am noticing that the Data tab can load the tables just fine, the Data tab connects via the public network, so if that works, the issue may be with your own network.


Status changed to Awaiting User Response Railway 8 months ago


Railway
BOT

4 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 4 months ago


Loading...