title: Bugsnag error when running artisan command
body: <p>I got this error when trying to run my <code>php artisan migrate</code> on my production server...</p>
  
  <pre><code>PHP Fatal error:  Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
  Stack trace:
  #0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client-&gt;__construct(NULL)
  #1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider-&gt;Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
  #2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container-&gt;build(Object(Closure), Array)
  #3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container-&gt;make('bugsnag', Array)
  #4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application-&gt;make('bugsnag', Array)
  #5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
  PHP Fatal error:  Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
  Stack trace:
  #0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client-&gt;__construct(NULL)
  #1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider-&gt;Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
  #2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container-&gt;build(Object(Closure), Array)
  #3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container-&gt;make('bugsnag', Array)
  #4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application-&gt;make('bugsnag', Array)
  #5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
  </code></pre>
  
  <p>I ran <code>env</code> on the command line and I have an env variable called <code>BUGSNAG_API_KEY</code> and the value of it exactly matches the key at bugsnag.com for this project.</p>
  
  <p>Furthermore, I have this line in my project at <code>./config/bugsnag.php</code></p>
  
  <p><code>'api_key' =&gt; env('BUGSNAG_API_KEY'),</code></p>
  
  <p>Weirdly, I eventually tried the same command again (<code>php artisan migrate</code>) and it worked! But it's left me very unsettled as it's a production server. So I'd like to understand the problem.</p>
  
  <p>Errors seem to be logging in Bugsnag as well by the way.</p>