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
Project ID:
6cafc58a-539d-45e6-a15e-96681a797525
6cafc58a-539d-45e6-a15e-96681a797525
can you add a
sleep 3
to the beginning of your start command?interesting fix, but didn't seem to work
show me your new start command please
sleep 3 && prisma generate && prisma migrate deploy && node -r dotenv/config build
that looks like a build command not a start command?
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?
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?
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
can you give exact time stamps?
Jan 09 22:21:01 is the earlierst one i can see in my logs
thats the timestamp directly from the log line?
yes
this is what it looks like for me
fwiw
just happened again
these are the earliest logs i can see
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
oh I think that does help, these errors would correlate with your app waking right?
that probably is the case, but i am not certain. its not me waking up the app so i am not sure
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
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