In a released React Native project none of my errors in Sentry show any stacktrace.
React-Native 0.39
I have this simple code to cause an error:
crash() {
const obj = {};
obj.something();
}
When this code is run in dev mode I see the following stack in Sentry:
TypeError: undefined is not a function (evaluating 'obj.something()')
at crash(/index.android.bundle:1622:9)
at touchableHandlePress(/index.android.bundle:37894:39)
at touchableHandlePress([native code])
at _performSideEffectsForTransition(/index.android.bundle:24063:26)
...
When I run this code in a release build all I see it this:
TypeError: undefined is not a function (evaluating 'e.something()')
at ? ([native code])
at ? ([native code])
at ? ([native code])
at ? ([native code])
at forEach([native code])
at ? ([native code])
(I didn’t setup the sourcemaps for both this examples, I’m not sure if this would make a difference).
Does anybody have any experience with using Sentry and React-Native in production?
Yeah, source maps won’t help here – we need a source location, which would appear where [native code] is.
If there’s a bug, it’s that our parser is choking on whatever React Native on Android is presenting as the “function”. If we can’t parse it, we show ? instead.
My react-native app is reporting errors via raven. Everyone is working fine on ios, but not on android. On android everything looks great in development, but in release it always reports the stack as just [native code]. Just one frame.
Besides minification and bundling, the only difference I can see between the two is this small change from adb logcat.
Dev:
12-19 17:35:38.375 31961 2904 W ReactNativeJS: My error message string here
12-19 17:35:38.385 31961 2904 W ReactNativeJS: { [My error message string here]
12-19 17:35:38.385 31961 2904 W ReactNativeJS: line: 106404,
12-19 17:35:38.385 31961 2904 W ReactNativeJS: column: 29,
12-19 17:35:38.385 31961 2904 W ReactNativeJS: sourceURL: 'http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false' }
Release:
12-19 17:29:21.585 30613 30647 W ReactNativeJS: My error message string here
12-19 17:29:21.605 30613 30647 W ReactNativeJS: { [My error message string here] line: 797, column: 2554, sourceURL: 'index.android.bundle' }
I can’t really imagine that the number of linebreaks there is relevant, so please let me know if I can help provide more info in any way.
We are seeing the same behavior at the moment with source maps enabled (both source and source maps are in Sentry as release artifacts)
Error: blah
at ? ([native code])
at ? ([native code])
at ? ([native code])
at ? ([native code])
at ? ([native code])
at forEach([native code])
at ? ([native code])
Any idea where to start looking?. Happy to help to get this fixed