sentry-electron icon indicating copy to clipboard operation
sentry-electron copied to clipboard

Report ANR event that is detect by sentry has no user infos

Open VictorWangRC opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

4.17.0

Framework Version

No response

Link to Sentry event

https://jupiter-ct.sentry.io/issues/4892881997/?project=1428302&query=&referrer=project-issue-stream&statsPeriod=1h

SDK Setup

Sentry.init({ dsn: sentryUrl, debug: debugMode, maxValueLength: MAX_VALUE_LENGTH, release: releaseVersion, initialScope: this._sentryInitialScope, ... });

Sentry.enableMainProcessAnrDetection({captureStackTrace: true});

Steps to Reproduce

I use Electron sdk of Sentry, on version 4.17.0 and I set userInfo by Sentry.configureScope((scope) => { scope.setUser(sentryUserInfo); // for EU Privacy, update email to Account ID ... }); while login success.

And reproduce steps:

  1. I open ANR detect by Sentry.enableMainProcessAnrDetection({captureStackTrace: true });
  2. I mock a ANR on main process;
  3. I find ANR event, but this event has no user info.

And I mock other sentry report not anr, the report on Sentry.io has userinfos, just ANR Event

Expected Result

ANR event should has user Info

Actual Result

There is no user info

VictorWangRC avatar Feb 02 '24 09:02 VictorWangRC

Hey @VictorWangRC thanks for writing in!

@timfish would you mind taking a look at this?

Lms24 avatar Feb 02 '24 12:02 Lms24

Currently there is no scope synchronization to the ANR process which includes user/tags/extra.

I've opened an issue to track this work in the JavaScript repository since that is where this code lives: https://github.com/getsentry/sentry-javascript/issues/10668

timfish avatar Feb 15 '24 02:02 timfish

The next v7 release will fix this but you should use the anrIntegration as enableMainProcessAnrDetection has been deprecated:

Sentry.init({
  dsn: '__DSN__',
  integrations: [Sentry.anrIntegration|({captureStackTrace: true})]
});

timfish avatar Apr 03 '24 13:04 timfish

This was fixed a few releases ago. It's worth noting that if the event loop remains blocked for more than 5 seconds after ANR is detected, we give up fetching the context.

timfish avatar May 03 '24 09:05 timfish