justbetter / magento2-sentry

Magento 2 module to log to Sentry
MIT License
165 stars 70 forks source link

Exceptions in Consumers are not sent to Sentry #100

Open VladyslavSikailo opened 2 years ago

VladyslavSikailo commented 2 years ago

Sentry module bug

In case exceptions are thrown from the Magento Consumer - they are not logged to Sentry. It might be a big problem for projects that use Queues.

Bug: What is the current behavior? Exceptions from Consumers just logged to log files, but not sent to Sentry.

Bug: What is the expected behavior? Exceptions from Consumers should be sent to Sentry.

Bug: What is the proposed solution?

Why exceptions from Consumer are not sent so Sentry? Because Sentry initialization happens using around plugin for Application class - \JustBetter\Sentry\Plugin\GlobalExceptionCatcher::aroundLaunch, but this application class doesn't exist when the application is launched from the CLI.

So we need to initialize Sentry plugin also for the CLI. How to do it?

Note: Maybe we don't need to have all exceptions from CLI logged to Sentry. But we 100% need to have all exceptions from Magento Consumer to be logged.

What is the version of Magento and of Sentry extension you are using? Always use the latest version of the extension one before opening a bug issue.