bugsnag/bugsnag-laravel

Bugsnag reporting with incorrect stage, should not report at all in stage development

dtmichel opened this issue · 1 comments

Describe the bug

Bugsnag is reporting errors with the wrong release stage. I have set APP_ENV and BUGSNAG_RELEASE_STAGE to development, but Bugsnag reports using stage production.

Environment

  • Bugsnag version: 2.22.2
  • PHP version: 8.0.8
  • Composer version: 2.1.8
  • Laravel version: 8.61.0

.env (shorted)
APP_ENV=development
LOG_CHANNEL=stack
LOG_LEVEL=error
BUGSNAG_API_KEY=*************************
BUGSNAG_RELEASE_STAGE=development
BUGSNAG_NOTIFY_RELEASE_STAGES=test,production

bugsnag.conf
'release_stage' => env('BUGSNAG_RELEASE_STAGE'),
'notify_release_stages' => empty(env('BUGSNAG_NOTIFY_RELEASE_STAGES')) ? null : explode(',', str_replace(' ', '', env('BUGSNAG_NOTIFY_RELEASE_STAGES'))),

I can create errors in .env and bugsnag.conf to force the web application to fail, so the config files seem to be read correctly.
I have run cache:clear and config:clear and I have restarted the web server.
I also tried to check what is going on within bugsnag-laravel, and the settings are read correctly in vendor/bugsnag/bugsnag/src/Configuration.php
I can reproduce this behaviour on another server with different stage (test), PHP, Laravel and OS. It always reports as production.

I found the issue in AppServiceProvider. I had a piece of code in there to initialise \Bugsnag\Client.