Look for user_context in the upgrade documentation of the sentry-php the Laravel integration uses.
I see the user context documentation is currently missing from the Laravel documentation so that will be added back later.
The gist is to do instead of $client->user_context(['email' => '[email protected]']); this:
use Sentry\Hub;
use Sentry\Scope;
Hub::getCurrent()->configureScope(function (Scope $scope): void {
$scope->setUser(['email' => '[email protected]']);
});
Indeed. Would be great to update examples configs as well.
We never had ik documented in the example since there is no user context in a clean Laravel setup, but it is documented correctly now!
no user context in a clean Laravel setup
Well, yes, but examples do contain user_context:
Ah, OK, these old examples are supposed to stick at the version < 1.
But they are partly been updated, that why it raises some confusions.
@LeoColomb good point, totally missed those :( Thanks for letting me know!
I updated those example to reflect the config option changes here: #197
For those who had cache config on remote server and are now trapped in a loop with that error, you must uninstall sentry/sentry-laravel by removing it from composer.json, deploy and do composer install, clear config, reinstall sentry, and deploy again.
Alternatively you can remove the config cache file manually: bootstrap/cache/config.php.
It's a real shame that this package stopped supporting sending user details out of the box. It feels incredibly lazy that I need to create a middleware to configure Sentry myself because the Laravel-specific Sentry bridge doesn't do it by itself.
Sorry you feel this way so strongly.
However, the option to add the user context is not gone but it鈥檚 called differently now.
You might have missed it in the new docs:
Starting with Laravel 5.3 we can automatically add the authenticated user id to the scope if
send_default_piioption is set totruein yourconfig/sentry.php.
So this option send_default_pii should be documented in the config/sentry.php
I think we shouldn't because then where do we stop with documenting options in there and syncing their defaults with the base package, there are quite a few and more may be added later at any time. Better to keep that in the documentation IMHO.
For reference, they are all documented here: https://docs.sentry.io/error-reporting/configuration/?platform=php
Most helpful comment
Alternatively you can remove the config cache file manually:
bootstrap/cache/config.php.