sentry-react-native
sentry-react-native copied to clipboard
Native Crashes are not reported
OS:
- [ ] Windows
- [x] MacOS
- [ ] Linux
Platform:
- [x] iOS
- [x] Android
SDK:
- [x]
@sentry/react-native
(>= 1.0.0) - [ ]
react-native-sentry
(<= 0.43.2)
SDK version: 0.0.0
react-native
version: 0.70.6
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:
[Link to issue]
Configuration:
(@sentry/react-native
)
Sentry.init({
dsn: 'https://[email protected]/...'
// other options
});
I have the following issue:
[Description]
Steps to reproduce:
- Crashes are not reported nor in production nor if they are forced with Sentry.nativeCrash();
Actual result:
- Only js crash has been reported
Expected result:
- Also native crashes need to be reported
Hi @ejjraifihamza,
thank you for the message,
can you share what version of @sentry/react-native
you are using? And what does your Sentry.init
look like?
Note the crashes are sent on the next application start and only work when the application crashes, which means when the React Native Red Box doesn't prevent the crash.
hi @krystofwoldrich, thanks for reply, my @sentry/react-native version is 5.20.0. for Sentry.init it's just basic config => Sentry.init({ dsn: SENTRY_DSN, tracesSampleRate: 1.0, }); i was able to catch js errors by put in my nested screen : throw new Error("My first Sentry error!"), but when i try native crash : Sentry.nativeCrash(), the app crash and i open it again but i can't see it in my project dashboard.
Hi @ejjraifihamza,
thank you for the details, can you share with us native logs from the iOS simulator or Logcat for Android, with debug: true
in the Sentry.init
options?
Hi @krystofwoldrich,
my native logs from the IOS simulator with debug: true,
LOG Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers LOG Sentry Logger [log]: Integration installed: NativeLinkedErrors LOG Sentry Logger [log]: Integration installed: InboundFilters LOG Sentry Logger [log]: Integration installed: FunctionToString LOG Sentry Logger [log]: Integration installed: Breadcrumbs LOG Sentry Logger [log]: Integration installed: Dedupe LOG Sentry Logger [log]: Integration installed: HttpContext LOG Sentry Logger [log]: Integration installed: Release LOG Sentry Logger [log]: Integration installed: EventOrigin LOG Sentry Logger [log]: Integration installed: SdkInfo LOG Sentry Logger [log]: Integration installed: ReactNativeInfo LOG Sentry Logger [log]: Integration installed: DebugSymbolicator LOG Sentry Logger [log]: Integration installed: RewriteFrames LOG Sentry Logger [log]: Integration installed: DeviceContext LOG Sentry Logger [log]: Integration installed: ModulesLoader LOG Sentry Logger [log]: Integration installed: ReactNativeTracing
@ejjraifihamza This looks like a JS logs from the application start, is there nothing more?
I was referring to logs from here:
If you can run the application from Xcode?
hi @krystofwoldrich,
i got a lot of logs (delete some that contain sensitive data) and i don't know which one do you need exact, if you need specific logs, just let me know, thanks
here is the logs:
[Sentry] [debug] [SentrySDK:174] Starting SDK...
'Sentry Logger [log]:', 'Unhandled promise rejections will be caught by Sentry.'
'Sentry Logger [log]:', 'Integration installed: ReactNativeErrorHandlers'
'Sentry Logger [log]:', 'Integration installed: NativeLinkedErrors'
'Sentry Logger [log]:', 'Integration installed: InboundFilters'
'Sentry Logger [log]:', 'Integration installed: FunctionToString'
[Sentry] [debug] [SentryHttpTransport:268] sendAllCachedEnvelopes start.
[Sentry] [debug] [SentryHttpTransport:280] No envelopes left to send.
[Sentry] [debug] [SentryHttpTransport:362] Finished sending.
[Sentry] [debug] [SentryReachability:180] Adding observer: <SentryHttpTransport: 0x600002631080>
[Sentry] [debug] [SentryReachability:182] Synchronized to add observer: <SentryHttpTransport: 0x600002631080>
[Sentry] [debug] [SentryReachability:212] registering callback for reachability ref <SCNetworkReachability 0x10f1940e0 [0x1e80c27e8]> {name = sentry.io}
[Sentry] [debug] [SentryReachability:138] SentryConnectivityCallback called with target: <SCNetworkReachability 0x10f1940e0 [0x1e80c27e8]> {name = sentry.io (complete, 35.186.247.156), flags = 0x00000002, if_index = 15}; flags: 2
[Sentry] [debug] [SentryReachability:103] Entered synchronized region of SentryConnectivityCallback with flags: 2
[Sentry] [debug] [SentryReachability:119] Notifying observers...
[Sentry] [debug] [SentryReachability:121] Notifying <SentryHttpTransport: 0x600002631080>
[Sentry] [debug] [SentryHttpTransport:106] Internet connection is back.
[Sentry] [debug] [SentryHttpTransport:268] sendAllCachedEnvelopes start.
'Sentry Logger [log]:', 'Integration installed: Breadcrumbs'
'Sentry Logger [log]:', 'Integration installed: Dedupe'
'Sentry Logger [log]:', 'Integration installed: HttpContext'
'Sentry Logger [log]:', 'Integration installed: Release'
'Sentry Logger [log]:', 'Integration installed: EventOrigin'
'Sentry Logger [log]:', 'Integration installed: SdkInfo'
'Sentry Logger [log]:', 'Integration installed: ReactNativeInfo'
'Sentry Logger [log]:', 'Integration installed: DebugSymbolicator'
'Sentry Logger [log]:', 'Integration installed: RewriteFrames'
'Sentry Logger [log]:', 'Integration installed: DeviceContext'
'Sentry Logger [log]:', 'Integration installed: ModulesLoader'
[Sentry] [debug] [SentrySDK:193] SDK initialized! Version: 8.21.0
[Sentry] [debug] [SentrySDK:195] Dispatching init work required to run on main thread.
[Sentry] [debug] [SentryThreadWrapper:26] Already on main thread.
[Sentry] [debug] [SentrySDK:197] SDK main thread init started...
[Sentry] [debug] [SentryFileManager:136] Dispatched deletion of old envelopes from <SentryFileManager: 0x600003388000>
[Sentry] [debug] [SentryHttpTransport:280] No envelopes left to send.
[Sentry] [debug] [SentryHttpTransport:362] Finished sending.
[Sentry] [debug] [SentryReachability:125] Finished notifying observers.
'Sentry Logger [log]:', '[ReactNativeTracing] Native frames instrumentation initialized.'
'Sentry Logger [log]:', '[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.'
'Sentry Logger [log]:', 'Integration installed: ReactNativeTracing'
[Sentry] [debug] [SentryCrashInstallationReporter:47] Sent 0 crash report(s)
[Sentry] [debug] [SentrySDK:434] Integration installed: SentryCrashIntegration
[Sentry] [debug] [SentryFramesTracker:79] Initialized frame tracker <SentryFramesTracker: 0x600002958070>
[Sentry] [debug] [SentrySDK:434] Integration installed: SentryAppStartTrackingIntegration
[Sentry] [debug] [SentrySDK:434] Integration installed: SentryFramesTrackingIntegration
[Sentry] [debug] [SentryBaseIntegration:29] Not going to enable SentryPerformanceTrackingIntegration because isTracingEnabled is disabled.
[Sentry] [debug] [SentryBaseIntegration:29] Not going to enable SentryScreenshotIntegration because attachScreenshot is disabled.
[Sentry] [debug] [SentryBaseIntegration:29] Not going to enable SentryUIEventTrackingIntegration because isTracingEnabled is disabled.
[Sentry] [debug] [SentryBaseIntegration:29] Not going to enable SentryViewHierarchyIntegration because attachViewHierarchy is disabled.
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x6000017cd880, {
category = started;
level = info;
message = "Breadcrumb Tracking";
timestamp = "2024-04-14T21:14:43.043Z";
type = debug;
}>
[Sentry] [debug] [SentryReachability:180] Adding observer: <SentryBreadcrumbTracker: 0x600000078c10>
[Sentry] [debug] [SentryReachability:182] Synchronized to add observer: <SentryBreadcrumbTracker: 0x600000078c10>
[Sentry] [debug] [SentrySwizzleWrapper:26] Swizzling sendAction for SentryBreadcrumbTrackerSwizzleSendAction
[Sentry] [debug] [SentryFileManager:652] Reading timezone offset
[Sentry] [debug] [SentrySDK:434] Integration installed: SentryAutoBreadcrumbTrackingIntegration
[Sentry] [debug] [SentryFileManager:480] No lastInForeground found.
[Sentry] [debug] [SentryBaseIntegration:29] Not going to enable SentryFileIOTrackingIntegration because isTracingEnabled is disabled.
[Sentry] [debug] [SentryBaseIntegration:29] Not going to enable SentryNetworkTrackingIntegration because isTracingEnabled is disabled.
[Sentry] [debug] [SentryHttpTransport:268] sendAllCachedEnvelopes start.
[Sentry] [debug] [SentrySDK:434] Integration installed: SentryNetworkTrackingIntegration
[Sentry] [debug] [SentryBaseIntegration:29] Not going to enable SentryMetricKitIntegration because enableMetricKit is disabled.
[Sentry] [debug] [SentryThreadWrapper:26] Already on main thread.
[Sentry] [debug] [SentryLaunchProfiling:157] No launch tracer present to stop.
[Sentry] [debug] [SentrySerialization:148] Header {"sdk":{"name":"sentry.cocoa.react-native","version":"8.21.0","packages":{"name":"cocoapods:getsentry\/sentry.cocoa.react-native","version":"8.21.0"}}}
[Sentry] [debug] [SentryLaunchProfiling:45] Won't profile next launch due to specified options configuration: options.enableAppLaunchProfiling: 0; options.enableTracing: 0
[Sentry] [debug] Item Header {"type":"session","length":299}
'Sentry Logger [log]:', 'Setting idle transaction on scope. Span ID: b0c8da07f4c78b11'
'Sentry Logger [log]:', '[Tracing] starting ui.load transaction - App Start'
'Sentry Logger [log]:', 'Starting heartbeat'
'Sentry Logger [log]:', 'pinging Heartbeat -> current counter: 0'
'Sentry Logger [log]:', '[ReactNativeTracing] Starting ui.load transaction "App Start" on scope'
'Sentry Logger [log]:', '[Tracing] Starting \'app.start.warm\' span on transaction \'Warm App Start\' (b0c8da07f4c78b11).'
'Sentry Logger [log]:', '[Tracing] pushActivity: 99918809c853c09e'
'Sentry Logger [log]:', '[Tracing] new activities count', 1
[Sentry] [debug] [SentryRequestOperation:34] Request status: 200
[Sentry] [debug] [SentryRequestOperation:38] Request response: {}
[Sentry] [debug] [SentryQueueableRequestManager:42] Queued requests: 0
[Sentry] [debug] [SentryHttpTransport:318] Deleting envelope and sending next.
[Sentry] [debug] [SentryHttpTransport:268] sendAllCachedEnvelopes start.
[Sentry] [debug] [SentryHttpTransport:280] No envelopes left to send.
[Sentry] [debug] [SentryHttpTransport:362] Finished sending.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x60000182b240, {
category = "device.orientation";
data = {
position = portrait;
};
level = info;
timestamp = "2024-04-14T21:14:43.973Z";
type = navigation;
}>
[Sentry] [debug] [SentrySystemEventBreadcrumbs:174] currentOrientation is unknown.
[Sentry] [debug] [SentryFramesTracker:180] Detected slow frame starting at 145087026960208 (frame tracker: <SentryFramesTracker: 0x600002958070>).
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x600001832180, {
category = "app.lifecycle";
data = {
state = foreground;
};
level = info;
timestamp = "2024-04-14T21:14:44.016Z";
type = navigation;
}>
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x600001850940, {
category = "ui.lifecycle";
data = {
beingPresented = false;
"is_window_rootViewController" = false;
parentViewController = UIViewController;
screen = RNSNavigationController;
window = "<UIWindow: 0x108812120; frame = (0 0; 393 852); gestureRecognizers = <NSArray: 0x600000cd0d50>; layer = <UIWindowLayer: 0x600000cd0570>>";
"window_isKeyWindow" = true;
"window_windowLevel" = "0.000000";
};
level = info;
timestamp = "2024-04-14T21:14:44.094Z";
type = navigation;
}>
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x600001762080, {
category = "ui.lifecycle";
data = {
beingPresented = false;
"is_window_rootViewController" = false;
parentViewController = RNSNavigationController;
screen = RNSScreen;
title = BottomTabStack;
window = "<UIWindow: 0x108812120; frame = (0 0; 393 852); gestureRecognizers = <NSArray: 0x600000cd0d50>; layer = <UIWindowLayer: 0x600000cd0570>>";
"window_isKeyWindow" = true;
"window_windowLevel" = "0.000000";
};
level = info;
timestamp = "2024-04-14T21:14:44.136Z";
type = navigation;
}>
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x600001762bc0, {
category = "ui.lifecycle";
data = {
beingPresented = false;
"is_window_rootViewController" = false;
parentViewController = RNSScreen;
screen = RNSContainerNavigationController;
window = "<UIWindow: 0x108812120; frame = (0 0; 393 852); gestureRecognizers = <NSArray: 0x600000cd0d50>; layer = <UIWindowLayer: 0x600000cd0570>>";
"window_isKeyWindow" = true;
"window_windowLevel" = "0.000000";
};
level = info;
timestamp = "2024-04-14T21:14:44.137Z";
type = navigation;
}>
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x600001775540, {
category = "ui.lifecycle";
data = {
beingPresented = false;
"is_window_rootViewController" = false;
parentViewController = RNSContainerNavigationController;
screen = RNSScreen;
window = "<UIWindow: 0x108812120; frame = (0 0; 393 852); gestureRecognizers = <NSArray: 0x600000cd0d50>; layer = <UIWindowLayer: 0x600000cd0570>>";
"window_isKeyWindow" = true;
"window_windowLevel" = "0.000000";
};
level = info;
timestamp = "2024-04-14T21:14:44.138Z";
type = navigation;
}>
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x6000017ba0c0, {
category = "ui.lifecycle";
data = {
beingPresented = false;
"is_window_rootViewController" = false;
parentViewController = RNSScreen;
screen = RNSNavigationController;
window = "<UIWindow: 0x108812120; frame = (0 0; 393 852); gestureRecognizers = <NSArray: 0x600000cd0d50>; layer = <UIWindowLayer: 0x600000cd0570>>";
"window_isKeyWindow" = true;
"window_windowLevel" = "0.000000";
};
level = info;
timestamp = "2024-04-14T21:14:44.138Z";
type = navigation;
}>
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x6000017fd240, {
category = "ui.lifecycle";
data = {
beingPresented = false;
"is_window_rootViewController" = false;
parentViewController = RNSNavigationController;
screen = RNSScreen;
title = HomeScreen;
window = "<UIWindow: 0x108812120; frame = (0 0; 393 852); gestureRecognizers = <NSArray: 0x600000cd0d50>; layer = <UIWindowLayer: 0x600000cd0570>>";
"window_isKeyWindow" = true;
"window_windowLevel" = "0.000000";
};
level = info;
timestamp = "2024-04-14T21:14:44.138Z";
type = navigation;
}>
[Sentry] [debug] [SentryFramesTracker:180] Detected slow frame starting at 145087186747416 (frame tracker: <SentryFramesTracker: 0x600002958070>).
[Sentry] [debug] [SentryRequestOperation:34] Request status: 200
[Sentry] [debug] [SentryRequestOperation:38] Request response: {}
[Sentry] [debug] [SentryQueueableRequestManager:42] Queued requests: 0
[Sentry] [debug] [SentryHttpTransport:318] Deleting envelope and sending next.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryHttpTransport:268] sendAllCachedEnvelopes start.
[Sentry] [debug] [SentryHttpTransport:280] No envelopes left to send.
[Sentry] [debug] [SentryHttpTransport:362] Finished sending.
[Sentry] [debug] [SentryNetworkTracker:352] captureFailedRequestsEnabled is disabled, not capturing HTTP Client errors.
[Sentry] [debug] [SentryFramesTracker:180] Detected slow frame starting at 145087683877250 (frame tracker: <SentryFramesTracker: 0x600002958070>).
[Sentry] [debug] [SentryFramesTracker:180] Detected slow frame starting at 145087933839875 (frame tracker: <SentryFramesTracker: 0x600002958070>).
'Sentry Logger [log]:', '[Tracing] finishing IdleTransaction', '2024-04-14T21:14:45.564Z', 'ui.load'
'Sentry Logger [debug]:', 'Removing AppState listener for ui.load transaction.'
'Sentry Logger [log]:', '[StallTracking] Stall measurements not added due to `endTimestamp` being set.'
'Sentry Logger [log]:', '[Tracing] flushing IdleTransaction'
'Sentry Logger [log]:', '[Measurements] Adding measurements to transaction', '{\n "app_start_warm": {\n "value": 7097.7861328125,\n "unit": "millisecond"\n }\n}'
'Sentry Logger [log]:', '[Tracing] Finishing ui.load transaction: App Start.'
[Sentry] [debug] [SentryFramesTracker:180] Detected slow frame starting at 145088644008375 (frame tracker: <SentryFramesTracker: 0x600002958070>).
'Sentry Logger [log]:', '[Measurements] Adding measurements to ui.load transaction App Start: {\n "frames_total": {\n "value": 65,\n "unit": "none"\n },\n "frames_frozen": {\n "value": 0,\n "unit": "none"\n },\n "frames_slow": {\n "value": 4,\n "unit": "none"\n }\n}'
[Sentry] [debug] [SentryScope:122] Add breadcrumb: <SentryBreadcrumb: 0x600001876880, {
category = "sentry.transaction";
level = info;
message = 099b54729d91443ca11103aae60fc47f;
timestamp = "2024-04-14T21:14:45.610Z";
}>
[Sentry] [debug] [SentrySerialization:148] Header {"event_id":"099b54729d91443ca11103aae60fc47f","sent_at":"2024-04-14T21:14:45.604Z","sdk":{"name":"sentry.javascript.react-native","version":"5.20.0"},"trace":{"environment":"development","public_key":"498dc76b3997483da201a38f0faf80b1","trace_id":"95c47774229b4fbdba91d751f9eea0c4","sample_rate":"1","transaction":"App Start","sampled":"true"}}
[Sentry] [debug] Item Header {"type":"transaction","content_type":"application/json","length":11952}
[Sentry] [debug] [SentryHttpTransport:268] sendAllCachedEnvelopes start.
[Sentry] [debug] [SentrySerialization:148] Header {"sdk":{"name":"sentry.javascript.react-native","version":"5.20.0","packages":{"name":"cocoapods:getsentry\/sentry.javascript.react-native","version":"5.20.0"}},"sent_at":"2024-04-14T21:14:45.604Z","trace":{"trace_id":"95c47774229b4fbdba91d751f9eea0c4","public_key":"498dc76b3997483da201a38f0faf80b1","environment":"development","sampled":"1","sample_rate":"1","transaction":"App Start"},"event_id":"099b54729d91443ca11103aae60fc47f"}
[Sentry] [debug] Item Header {"type":"transaction","length":11952}
[Sentry] [debug] [SentryFramesTracker:180] Detected slow frame starting at 145088667690291 (frame tracker: <SentryFramesTracker: 0x600002958070>).
[Sentry] [debug] [SentryRequestOperation:34] Request status: 200
[Sentry] [debug] [SentryRequestOperation:38] Request response: {"id":"099b54729d91443ca11103aae60fc47f"}
[Sentry] [debug] [SentryQueueableRequestManager:42] Queued requests: 0
[Sentry] [debug] [SentryHttpTransport:318] Deleting envelope and sending next.
[Sentry] [debug] [SentryHttpTransport:268] sendAllCachedEnvelopes start.
[Sentry] [debug] [SentryHttpTransport:280] No envelopes left to send.
[Sentry] [debug] [SentryHttpTransport:362] Finished sending.
@ejjraifihamza Is this log till the moment manually trigger the crash? Do you let the app crash or is the crash stopped by Xcode? On the next app start instead of No envelopes left to send.
there should be at least one envelope to send, the crash.
hi @krystofwoldrich
when i navigate to the screen that trigger => useEffect(() => { Sentry.nativeCrash(); }, []);
the app is freezing and xcode become as img below, when i try to open the app again stuck in splash screen till i build again then the app open again, (using physical device Iphone 11 pro), thanks
+1, having the same issue, native crashes aren't reported, android/ios
sdk configs => "@sentry/react-native": "^5.19.2",
@ejjraifihamza Thank you for the information, Xcode stops the application before Sentry can record the crash, please test it with Xcode detached, crash the app, open it again and then you should see the crash reported in Sentry.
@krystofwoldrich Thanks for your response. It's working now, but what happens if the user who experienced the crash doesn't reopen the app for two days? does the report send to sentry?
I'm happy to heat that it works now!
@ejjraifihamza The crash is save to disk and stays there until the app is launched again. The crash will be sent when the user opens the app, be it after two or mote days.
If the user never launches the app, uninstalls it or removes the app data, then the crash won't be reported.