a year ago
django.db.utils.OperationalError: connection to server at "monorail.proxy.rlwy.net" (35.212.181.170), port 21948 failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
23 Replies
a year ago
Are you getting this error from your app when running on Railway or when you run your app locally?
a year ago
Are you sure you are using all the correct credentials?
Can you connect to the database on Railway locally with software like dbgate?
a year ago
yes. I can make a connection and I can use it for like 2 seconds then I run into the error. (attached is the screenshot from the production, and i attached the posgres logs.)
Attachments
a year ago
Please connect to your database within Railway using private networking. Doing so will improve performance, reliability, and lower your egress bills.
a year ago
is it the one that says private database url? this is what I get back: django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: No such host is known.
a year ago
Yes. Could you try adding a ENABLE_ALPINE_PRIVATE_NETWORKING=true
service variable to your Django app, and do a sleep 3 && <your_start_cmd_here>
in your start command?
a year ago
Alpine private networking is enabled.
Using private database URL
Unable to connect to the database: connection to server at "monorail.proxy.rlwy.net" (35.212.181.170), port 21948 failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
a year ago
why when i use ENABLE_ALPINE_PRIVATE_NETWORKING=true, i get django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: No such host is known?
a year ago
I have deleted your message, never ever share that anywhere.
I asked for a link to your database service, not your database url.
a year ago
https://github.com/railwayapp-templates/postgres-ssl/pkgs/container/postgres-ssl
a year ago
https://railway.app/project/9af7b6ee-1fe4-4acc-8f35-dd38fd385aad/service/aae9d3bb-63b0-4c17-93e2-98820b8a399d/settings
a year ago
I see that you're using the private address now and it appears to be working. Can you confirm and that your service is fully operational please.
a year ago
yes. I see the logs is using the private url on the service. I guess I should of been more specific, I was trying to connect it on my IDE.
Status changed to Solved Railway • about 1 year ago