getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.56k stars 331 forks source link

Sentry.lastEventId() returning undefined on relaunch after crash #2789

Open Arron-Gill opened 1 year ago

Arron-Gill commented 1 year ago

OS:

Platform:

SDK:

SDK version: 4.12.0

react-native version: 0.69.3

Are you using Expo?

Are you using sentry.io or 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://...@sentry.io/...'
      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:

Actual result:

undefined

Expected result:

Some sort of Id

marandaneto commented 1 year ago

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.

ludwig-pro commented 1 year ago

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

krystofwoldrich commented 1 year ago

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

ludwig-pro commented 11 months ago

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