Bad postgres.js/Postgres DB internal connection
deafenestration
FREEOP

5 months ago

I'm using the free tier to host a smaller private version of a Discord bot I'm developing, which depends on a Postgres database. A nearly identical setup has been working fine for over a year in a Hobby workspace. This exact project I'm sending to Railway runs fine on my local machine.

While both the bot service and the database seem perfectly healthy, the internal connection between them is broken. The initial 1-3 queries succeed, but any following ones get totally lost on the way to the DB without creating any errors. (Except occasionally one manages to complete?).

I initially blamed it on Bun's compatibility with postgres.js, but nothing I tried to fix it made any difference and the issue persisted after switching to Deno, and now I'm noticing the database log
could not receive data from client: Connection reset by peer
and
could not receive data from client: Connection timed out
for some requests.

Also the 2 services are on different continents but I can't change regions on the free plan. No other ideas...

Solved$10 Bounty

Pinned Solution

deafenestration
FREEOP

5 months ago

Resolved! It seems like the Railway internal connection proxy was breaking/ignoring the connection while pretending it's fine, likely a consequence of serverless meddling + low priority of the free tier. The TCP stack was satisfied enough with this so it never threw any errors or timed out even though nothing was being done.

The final solution: Just use the database's public connection string!

P.S. I wish there was a way to report the obvious AI bounty farming above. It's like, not even a good response by AI response standards

3 Replies

Railway
BOT

5 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!


deafenestration
FREEOP

5 months ago

Resolved! It seems like the Railway internal connection proxy was breaking/ignoring the connection while pretending it's fine, likely a consequence of serverless meddling + low priority of the free tier. The TCP stack was satisfied enough with this so it never threw any errors or timed out even though nothing was being done.

The final solution: Just use the database's public connection string!

P.S. I wish there was a way to report the obvious AI bounty farming above. It's like, not even a good response by AI response standards


Status changed to Solved deafenestration 5 months ago


deafenestration

Resolved! It seems like the Railway internal connection proxy was breaking/ignoring the connection while pretending it's fine, likely a consequence of serverless meddling + low priority of the free tier. The TCP stack was satisfied enough with this so it never threw any errors or timed out even though nothing was being done.The final solution: Just use the database's public connection string! P.S. I wish there was a way to report the obvious AI bounty farming above. It's like, not even a good response by AI response standards

5 months ago

Hey deafenestration thanks for the suggestion! Will talk to the team about that feature.


Status changed to Awaiting Railway Response Railway 5 months ago


Status changed to Solved noahd 5 months ago


Loading...