Skip to content

iOS doesn't update session when handled:false set in JS  #3614

@pierricklete

Description

@pierricklete

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • [] Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.19.0

react-native version: 0.70.13

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

iOS unexpected crash rate

Android expected crash rate

Configuration:

(@sentry/react-native)

const detectSoftCrash = (event: Sentry.Event) => {
  if (event.tags && event.tags['caughtByErrorBoundary']) {
    const exceptions = event?.exception?.values;
    forEach(exceptions, (exceptionValue) => {
      if (exceptionValue) {
        exceptionValue.mechanism = {
          type: 'onerror',
          handled: false,
        };
      }
    });
    event.level = 'fatal';
  }
  return event;
};

Sentry.init({ 
  environment,
  dsn,
  beforeSend: detectSoftCrash,
 })

I have the following issue:

context: We want to measure number of errors caught by Sentry React error boundary, as a rate depending of number of sessions

According documentation, session with unhandled errors should be marked as crashed

Setting explicitly mechanism:{type: 'onerror', handled: false} to a Sentry error event results into:

  • (expected) an unhandled event on both platforms
  • (expected) a crashed session on Android
  • (unexpected) an healthy session on iOS

Steps to reproduce:
using beforeSend, set mechanism={type: 'onerror', handled: false} to exceptions attached to a Sentry event

Actual result:

  • on Android release dashboard, the crash rate considers unhandled errors
  • on iOS release dashboard, the crash rate does not consider unhandled errors (even though they appear in unhandled issues table)

Expected result:

  • on Android release dashboard, the crash rate does consider unhandled errors
  • on iOS release dashboard, the crash rate does consider unhandled errors

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions