justbetter / magento2-sentry

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

Lazily get user context if we should be able to #152

Open indykoning opened 1 week ago

indykoning commented 1 week ago

Summary

Fixes: https://github.com/justbetter/magento2-sentry/issues/79#issuecomment-2476730789

In some cases the user may be logged out because we inject the UserContextInterface before Magento has had the chance to populate it.

Result

With this change we check wether the area code can be fetched, and if it is an area code where user context might be available. And only then inject the userContext so. This should ensure user context is already compiled and added.

Checklist