Closed fpcorso closed 3 years ago
This error usually happens when the bugsnag service provider has not been added (in the right place) to your config/app.php
file.
@GrahamCampbell We have it in the app.php file above the app service provider as the documentation says to. Is there a different place for it?
// Other providers omitted...
Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class,
\App\Providers\DingoServiceProvider::class,
App\Providers\AppServiceProvider::class,
// Other providers omitted...
What happens when you type config('app')
into php artisan tinker
?
@GrahamCampbell Using config('app')
inside tinker shows a variety of information including the providers. Bugsnag is listed in the providers as shown in this screenshot:
The Bugsnag provider is too low there. You need to add it before your app service providers.
Ah, sorry @GrahamCampbell , thought the docs meant before the AppServiceProvider
not before all app level providers.
Unfortunately, that did not resolve this issue. First, I tried moving it to the top of the app-level providers and clearing config and cache. The same issue occurred. Here is the screenshot of it's order using config('app')
:
Then, I tried moving it all the way to the beginning of the array and clearing the config and cache. The same issue occurred. Here is the screenshot of it's order using config('app')
:
Edit: Hey @fpcorso, sorry, I missed the default
selection for dev_stack
you've made in your code. Do you also have a LOG_CHANNEL
in your .env
.
As per the email comms too, are you able to send us a cut down repro for us to investigate this a bit further?
@xander-jones This is a fairly large Laravel app with Scout, Nova, Elastic Search, and many integrations and layers. Not sure I'll have the time to create a cut-down repo for you. But, I did take a few minutes to walk through Xdebug to see if I can get some more details.
Unfortunately, it mostly mirrors the info from the stack trace:
During an exception, we do get into Laravel's LogManager's get which is where this error message is coming from: https://github.com/laravel/framework/blob/8.x/src/Illuminate/Log/LogManager.php#L123
Within that with
function, it calls its resolve
function. That is where the exception occurs. We pass all the if conditonals and end on the throw new InvalidArgumentException
line: https://github.com/laravel/framework/blob/8.x/src/Illuminate/Log/LogManager.php#L205
As shown in the screenshot, the $driverMethod
that is checked for is createBugsnagDriver
:
I've never dived into Laravel's logging system before so I am sorry if all of this was super obvious to you already.
If there is a better section of code for me to step through to give you info, please let me know.
Do you have a package which is re-registering laravel'\s logger after bugsnag has already registered itself with it, effectively deleting bugnsnag's driver registration?
@GrahamCampbell @xander-jones over in an email response from Bugsnag, John pointed out the stack trace goes through Dingo. I did a little digging and it seems Dingo has its own exception handling.
All of our routes go through or adds in the Dingo router and we have many hooks into it throughout our provider(s) so I am not sure if I can eliminate/comment out enough of Dingo to know for sure if that is indeed the issue.
That said, their handler does call its parent handler's report
method so not sure if this is this issue or not: https://github.com/dingo/api/blob/master/src/Exception/Handler.php#L83
Unfortunately, I don't have any more time this week to debug this further.
Hi @fpcorso,
Did you manage to get any further with this? We've not been able to reproduce the issue you are seeing. Has any new information come to light? I appreciate there would be some effort involved but if it were possible to create a reproduction example project that demonstrates this behaviour it would really help us progress the investigation. Thanks
Closing as we have not heard back. If you do have any further information on this or are able to send through a reproduction example, please comment below and we will reopen this issue. Please also feel free to write into support@bugsnag.com.
Describe the bug
We have followed the installation and configuration documentation for adding BugSnag to our Laravel application: https://docs.bugsnag.com/platforms/php/laravel/
Our Laravel app is within a docker container. We have our API key as an env variable.
Our logging.php is lengthy, but here are the relevant parts:
If I use the Bugsnag client, it works correctly:
shows here:
However, any unhandled exception gets put into our
emergency
logger and statingDriver [bugsnag] is not supported
.I saw previous issues of #379 and #333. I have tried:
php artisan config:clear
php artisan clear-compiled
php artisan cache:clear
php artisan optimize:clear
php artisan route:clear
Unfortunately, none of those resolved the issue.
Environment
Error
Here is the stacktrace of the error: