Closed usrNotFound closed 1 year ago
We don't yet provide support for using Bugsnag in AWS Lambda environments such as Laravel Vapor.
We suspect the issue is likely to be that the process is being terminated before the error report is delivered to Bugsnag, as the report is being sent asynchronously.
In general for serverless environments, setting the batch sending option to false
may help as this will send the report when the error occurs:
https://docs.bugsnag.com/platforms/php/laravel/configuration-options/#batch-sending
This may not resolve the issue you're seeing for queued jobs though.
We'll be sure to update this issue if we release full support in the future.
@usrNotFound Laravel changes your default logging configuration to the stderr
channel, which is captured and logged by AWS CloudWatch. You can follow this guide: https://flareapp.io/docs/ignition-for-laravel/installation#using-flare-on-vapor and change it for Bugsnag.
Both issues are true I believe - you need to configure your logging.php
correctly for Vapor, and also disable batch sending.
I have the following config/logging.php
(some stuff omitted):
<?php
return [
'default' => env('LOG_CHANNEL', 'stack-'.env('APP_ENV')),
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'bugsnag'],
'ignore_exceptions' => false,
],
'stack-production' => [
'driver' => 'stack',
'channels' => ['single', 'stderr', 'bugsnag'],
'ignore_exceptions' => false,
],
'stack-staging' => [
'driver' => 'stack',
'channels' => ['single', 'stderr', 'bugsnag'],
'ignore_exceptions' => false,
],
],
];
Web requests appear to send errors to Bugsnag just fine, but queue jobs do not.
In the past, I've seen this happen when __destruct()
calls are never fired in PHP. This happens when running tinker
sessions, and apparently also with queue jobs with Vapor.
Setting batch settings to false
can indeed help this:
BUGSNAG_BATCH_SENDING=false
You probs don't wanna write to single on vapor. It'll just fill your tmp directory. If you write a lot, you'll start getting 502s from api gateway.
I was wondering about that - I've been assuming each lambda and its tmp drive is killed between each request. I guess that's not the case?
No. They keep it around. This is how warm starts are implemented. Each lambda is not gonna share the same tmp directory, but the filesystem from one that has shutdown already can get reused for another lambda about to boot. :)
@gareththackeray You just linked localhost
@gareththackeray You just linked
localhost
Oops thanks. Fixed
This only happens on a project running on laravel-vapor
Describe the bug
Laravel vapor project won't report an error on bugsnag for failed queued job.
Steps to reproduce
configure logging
Add BugsnagServiceProvider to app.php
set
QUEUE_CONNECTION
to `'redis', 'sqs' anything other than 'sync'Create a job and implement
ShouldQueue
withthrow new Exception
Run project and dispatch the job.
Environment