sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Sentry.lastEventId() returning undefined on relaunch after crash

Open Arron-Gill opened this issue 3 years ago • 4 comments

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

Platform:

  • [x] iOS
  • [ ] Android

SDK:

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

SDK version: 4.12.0

react-native version: 0.69.3

Are you using Expo?

  • [ ] Yes
  • [x] No

Are you using sentry.io or on-premise?

  • [x] sentry.io (SaaS)
  • [ ] on-premise

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

N/A

Configuration:

(import * as Sentry from "@sentry/react-native";)

Sentry.init({
      sampleRate: sampleRate?.errorSampleRate
        ? sampleRate?.errorSampleRate
        : 0.5, //We fetch the sample rate on app launch/initialization we have a 50% sample rate as a fallback in the event we fail to fetch or device is offline
      enableNativeCrashHandling: true,
      // allows redux object to serialise deeply
      normalizeDepth: 5,
      dsn: 'https://[email protected]/...'
      environment: jsEnv.SENTRY_ENVIRONMENT,
      integrations: [
        rewriteFramesIntegration,
        new ExtraErrorData({ depth: 4 }),
        new Sentry.ReactNativeTracing({
          routingInstrumentation
        })
      ],
      ...sentryOptions
    });

I have following issue:

Tried calling Sentry.lastEventId() on the main screen of our app after a crash had happened and it returned undefined. Looks like event Id is not persisted?

Steps to reproduce:

  • Call nativeCrash() from "@sentry/react-native"
  • On app relaunch call Sentry.lastEventId() and inspect value returned.

Actual result:

undefined

Expected result:

Some sort of Id

Arron-Gill avatar Jan 26 '23 15:01 Arron-Gill

Sentry.lastEventId() isn't persisted for hard crashes, you are correct. IIRC lastEventId is persisted on Android and iOS, maybe we can leverage the RN bits for that, I'll check it.

marandaneto avatar Jan 27 '23 14:01 marandaneto

Hi, do you have an update on this feature? I find it surprising that we can't tell if the application crashed in the previous session on react-native

ludwig-pro avatar Aug 29 '23 10:08 ludwig-pro

@ludwig-pro Hi, thanks for your interest, we want to do this, but there is no closer plan yet.

krystofwoldrich avatar Aug 31 '23 10:08 krystofwoldrich

👋 If you want to have this feature => https://github.com/a7ul/react-native-exception-handler

ludwig-pro avatar Sep 22 '23 11:09 ludwig-pro