Jul 17, 2020
0
Level 2
Randomly happening Query Exception
Hello everyone,
Recently, I have faced a weird problem. I am building a SPA application. Sometimes, query exception happens for specific endpoint just by reloading.
In the handler.php
else if($exception instanceof QueryException){
$exception = FlattenException::create($exception);
return response()->prettyApi([
'data'=>[],
'access'=>false,
'message' => config('app.env') == 'local'?$exception->getMessage():'Query Exception Occurred',
'status'=>400
]);
}
I research and found that if I reload the page randomly generate this error because all config becomes default. For example database=forge username=forge but in the env all configuration is set properly.
This error occurs randomly if I reload the page consecutively but sometime without reloading.
It is mentionable that caching config solves this issue.
Please or to participate in this conversation.