Error: P1001: Can't reach database server at `postgres.railway.internal`:`5432`

Container keeps crashing, says it can't reach my database. I use private networking with the private database url. This has happened a few times, randomly, where suddenly the server cannot reach the database. Restarting sometimes works, sometimes it does not.
22 Replies
Percy
Percy11mo ago
Project ID: 6cafc58a-539d-45e6-a15e-96681a797525
thomasmol
thomasmolOP11mo ago
6cafc58a-539d-45e6-a15e-96681a797525
Brody
Brody11mo ago
can you add a sleep 3 to the beginning of your start command?
thomasmol
thomasmolOP11mo ago
interesting fix, but didn't seem to work
Brody
Brody11mo ago
show me your new start command please
thomasmol
thomasmolOP11mo ago
sleep 3 && prisma generate && prisma migrate deploy && node -r dotenv/config build
Brody
Brody11mo ago
that looks like a build command not a start command?
thomasmol
thomasmolOP11mo ago
it is not, it starts the server disabling and enabling private networking on my db service did just fix it but this still happens randomly, when my server is running not during build or start any ideas why it happens randomly?
Brody
Brody11mo ago
i run a testing to lookup an internal address. over the span of 7 days and ~600,00 tests, only 7 of them have failed. that does not explain the frequency at witch you are seeing the errors. but railway has multiple internal dns servers, so i will tag in char8 to get his opinion can you provide some timestamps?
thomasmol
thomasmolOP11mo ago
hmm okay thanks! it started not reaching the db yesterday jan 9 at around 22:20 (amsterdam time, gmt+1 i think) it retries a few times, by restarting the container, but eventually failed and i received an email that the service crashed at 22:23
Brody
Brody11mo ago
can you give exact time stamps?
thomasmol
thomasmolOP11mo ago
Jan 09 22:21:01 is the earlierst one i can see in my logs
Brody
Brody11mo ago
thats the timestamp directly from the log line?
thomasmol
thomasmolOP11mo ago
yes
thomasmol
thomasmolOP11mo ago
this is what it looks like for me
No description
thomasmol
thomasmolOP11mo ago
fwiw just happened again
thomasmol
thomasmolOP11mo ago
these are the earliest logs i can see
No description
thomasmol
thomasmolOP11mo ago
this pattern repeats a few times, then, the service crashes btw, this happens on a service where i enabled App Sleeping i guess it that might be the problem since app sleeping is still in beta? hopefully this helps solving it plus2
Brody
Brody11mo ago
oh I think that does help, these errors would correlate with your app waking right?
thomasmol
thomasmolOP11mo ago
that probably is the case, but i am not certain. its not me waking up the app so i am not sure
Brody
Brody11mo ago
well any external call to your app while it's sleeping would wake it, doesn't need to be you assessing the app, could be the Google bot looking for a robots.txt file can you try this users solution here? https://discord.com/channels/713503345364697088/1194241277517115443/1194568475071483944
thomasmol
thomasmolOP11mo ago
alright thanks! just did, no issues so far okay tried updating prisma and added the command to the database url but still resulted in a crash, same log patterns as before
Want results from more Discord servers?
Add your server