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
Project ID:
31a7f69c-e284-469d-bfac-e7c9ca208610
Project ID:
31a7f69c-e284-469d-bfac-e7c9ca208610
is your app trying to connect to the database via the public or private url?
I was trying to connect with public URL
try the private url?
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.${{MySQL.MYSQLHOST}}
is correctI 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.
hard coding database variables is never the solution
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.
yes but what solved it was something else, like the re-deploy caused by changing the variable
I have tried to do re-deploy and restart but did not solve my problem