Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yii not reporting user informations #57

Open
koffisani opened this issue Sep 16, 2021 · 1 comment
Open

Yii not reporting user informations #57

koffisani opened this issue Sep 16, 2021 · 1 comment
Assignees

Comments

@koffisani
Copy link

I just configured this plugin as follows :

'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning','info'],
                ],
                [
                    'class' => 'notamedia\sentry\SentryTarget',
                    'dsn' => 'http://<id>@<server-address>/4',
                    'levels' => ['error', 'warning'],
                    // Write the context information (the default is true):
                    'context' => true,
                    // Additional options for `Sentry\init`:
                    //'clientOptions' => ['release' => '[email protected]']
                    'on beforeAction' => function (\yii\base\ActionEvent $event) {
                        Yii::error("Test");
                        /** @var \yii\web\User $user */
                        $user = Yii::$app->has('user', true) ? Yii::$app->get('user', false) : null;
                        if ($user && ($identity = $user->getIdentity(true))) {
                            \Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($identity) {
                                $scope->setUser([
                                    // User ID and IP will be added by logger automatically
                                    'username' => $identity->username,
                                    'email' => $identity->email,
                                ]);
                            });
                        }

                        return $event->isValid;
                    },
                ],
            ],
        ],

But unfortunately, only user's ID and IP are reported. Is there anything I've done wrong ? Thanks.

@CookiesEater CookiesEater self-assigned this Oct 15, 2021
@CookiesEater
Copy link
Member

Hi!

Sorry, but for now behavior of this feature is broken in sentry-php, please track this issue: getsentry/sentry-php#1175

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants