Package + Version
Version:
4.6.4
Description
- We was using
Raven.js client and it was working, But when we decided to upgrade to new Sentry official SDK for angular2 @sentry/browser, We noticed strange behavior after Sentry log error by captureException return event_id & Sentry.lastEventId() neither matched nor exists with event_id that logged on Sentry 9.0.0, This happened when pass error to captureException, But i works with captureException and when pass new Error(msg), What i expect is when captureMessage error with stackTrace make Sentry client behave wrong when generate event_id.
- After Sentry captureException
Sentry.init({
dsn: 'our_dsn',
whitelistUrls: [some_pattern],
});
handleError(error) {
const event_id = Sentry.captureException(error); // wrong/not matched event_id
console.log(event_id); // 2a4f76154e1446f8baa4cf5e38ed2d7f
console.log(Sentry.lastEventId()); // 2a4f76154e1446f8baa4cf5e38ed2d7f
// But expected & what is logged in server is `96474888a8154c409c0dcbea29d792ad`
// Raven.captureException(error); // Np correct & matched event_id
// Sentry.captureException(new Error(error.stack)); // Np correct & matched event_id, but missing frames, extra info on server..
// Sentry.captureMessage(error.message); // Np correct & matched event_id
}
Fixed in https://github.com/getsentry/sentry-javascript/releases/tag/5.11.2
@aliaz0 please see https://github.com/getsentry/sentry-javascript/issues/4534
This has to do with react running in dev mode and rethrowing errors caught in error boundaries. If you run your app in production mode, you should only get one event.
I have the same issue with Sentry.captureEvent()
While Sentry.captureMessage( … ) returns the correct event Id, Sentry.captureEvent( … ) returns a different event Id.