R
Railway11mo ago
bledar

Application sometimes is failing to connect with the DB

Since yesterday we are having a wired problem with our Laravel app since some of the request are failing due to db connection error: The error I am getting is php_network_getaddresses: getaddrinfo failed: Name does not resolve at . Php fails to resolve host address of the DB. This problems is not happening in every request but the majority of them are failing. The load of the DB and the app seems to be fine. I have also migrated a couple of days ago to the new DB system. ProjectID: 31a7f69c-e284-469d-bfac-e7c9ca208610
12 Replies
Percy
Percy11mo ago
Project ID: 31a7f69c-e284-469d-bfac-e7c9ca208610
Percy
Percy11mo ago
Project ID: 31a7f69c-e284-469d-bfac-e7c9ca208610
Brody
Brody11mo ago
is your app trying to connect to the database via the public or private url?
bledar
bledarOP11mo ago
I was trying to connect with public URL
Brody
Brody11mo ago
try the private url?
bledar
bledarOP11mo ago
I actually was referencing the MYSQLHOST in the env as ${{MySQL.MYSQLHOST}} and after seting this host url manually with referencing seems to fix the problem.
Brody
Brody11mo ago
${{MySQL.MYSQLHOST}} is correct
bledar
bledarOP11mo ago
I am not sure what was the problem but changing DB HOST to put the value as string fixed the problem in the app. The strange thing was that not all the request were not failing all the time. The same request sometimes was resolved with success sometime was rejected.
Brody
Brody11mo ago
hard coding database variables is never the solution
bledar
bledarOP11mo ago
You guys can investigate more if this is only my problem or is affecting others as well. ...but in my case is solving the problem. I will try to use again the referenced variable and hoping that will not cause problems again.
Brody
Brody11mo ago
yes but what solved it was something else, like the re-deploy caused by changing the variable
bledar
bledarOP11mo ago
I have tried to do re-deploy and restart but did not solve my problem
Want results from more Discord servers?
Add your server