connecting to postgres with sqlx via private networking
hey, im just trying to deploy a simple rust rest api which uses sqlx.
can't connect because the hostname is not being resolved, also couldnt connect because of some ssl issue which i would also like to solve but for now ive disabled ssl (it doenst really matter since they're communicating on the private network)
seen here it takes a couple seconds for private networking to become available but it seems to retry for a few times after deployment but still fails. help
11 Replies
Project ID:
N/A
N/A
railways retries don't help in this case since it reruns the container and every time it does that private networking initialisation times still exist.
are you building with nixpacks?
have you tried adding a simple 5 second sleep in code before the connection attempt? (if you do this please use a healthcheck)
@joao I believe you are experiencing the same SSL issue as I am. I have filed an issue https://github.com/railwayapp-templates/postgres-ssl/issues/6. Let's see.
GitHub
Issues · railwayapp-templates/postgres-ssl
Contribute to railwayapp-templates/postgres-ssl development by creating an account on GitHub.
yeah that fixes it thanks
might be, when I have time I’ll debug it better. can’t remember the error right now but I believe it was something in the lines of yours
if the sleep for 5 second fixes it, its not an ssl error
@ramnivas can you try a sleep for 5 seconds too?
@Brody I am connecting from my laptop to an existing Railway Postgres service. Unclear, where I would add sleep. Please see the https://github.com/ramnivas/railway-postgres-rust repo for context.
GitHub
GitHub - ramnivas/railway-postgres-rust
Contribute to ramnivas/railway-postgres-rust development by creating an account on GitHub.
gotcha, you didnt state where you where connecting from in your gh issue
@Brody Good point. Updated the issue.
no need for the pings, please read #🛂|readme #5
i believe it was really an ssl problem, something separate from this issue
yes th 5s wait fixes the conn but i had to disable ssl to be able to use