Application failed to access database
Hey, while I'm trying to run a webapp, the container fails to connect to any databases. Redis shows timeout, while Prisma (PostgreSQL) shows unreachable. But when I run it locally, everything connects.
Solution:Jump to solution
currently it takes around 100ms for railnet0 (the private networking interface) to become bound, and then up to 3 seconds before the private network's dns server will resolve internal domains) in these time frames, even though you aren't using the private network, external requests can behave very wonky
23 Replies
Project ID:
365c4033-f34a-46b5-93ba-f8cf23b3211c
can i see a screenshot of your service variables?
I'm using railway's database service so database variables are automatically injected.
Prisma also shows the database url when thrown error, which confirms that there's no issue with the variable.
please show me the screenshot anyways
where are your postgres and redis databases hosted?
in the railway project
delete the current database variables and setup the variable references for them please
https://docs.railway.app/develop/variables#railway-provided-variables
then show me another screenshot
Well looks like that fixes it. Though the deployment log still shows bunch of timeout and connection error messages.
then show me another screenshot please
there we go
do you have private networking turned on in the service settings?
I believe it is
are you utilizing the private network?
yup, is that affecting external connections?
ideally it shouldn't, but there's some caveats of the private networking system that have a slim chance of causing issues with network requests that are done right when the app starts
Well, that probably explains the initial connection errors.
disable it and let me know how it goes
Confirmed, the inital connection errors no longer occurs.
unfortunately they went ahead and made private network enabled by default before some of the issues where fixed
Solution
currently it takes around 100ms for railnet0 (the private networking interface) to become bound, and then up to 3 seconds before the private network's dns server will resolve internal domains) in these time frames, even though you aren't using the private network, external requests can behave very wonky
Good to know. Hopefully the network system will improve later on.
I'm sure they will