OS:
_Platform:_
SDK:
@sentry/react-nativereact-native-sentryreact-native version: 0.60.4
Init Code:
Sentry.init({
dsn: 'https://[email protected]/...'
});
I have following issue:
not working on Android 9 (simulator or device)
Description goes here ...
Steps to reproduce:
Actual result:
url to repo (simple app)
https://bitbucket.org/webforuse/sandbox/src/master/
Same issue.
My context:
com.facebook.react.bridge.UnexpectedNativeTypeException: Value for id cannot be cast from Double to String
at com.facebook.react.bridge.ReadableNativeMap.checkInstance(ReadableNativeMap.java:141)
at com.facebook.react.bridge.ReadableNativeMap.getNullableValue(ReadableNativeMap.java:129)
at com.facebook.react.bridge.ReadableNativeMap.getString(ReadableNativeMap.java:163)
at io.sentry.RNSentryModule.getUserBuilder(RNSentryModule.java:313)
at io.sentry.RNSentryModule.sendEvent(RNSentryModule.java:217)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:193)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:764)
I found the origin of the crash and a workaround (at least for my case).
The origin is
setUsermethod that does not support anything else thanstringfor data (my case I just neededid).
Sentry.setUser({
id: SOME_ID, // will crash if id is not a string, ex: a number will crash 鈥硷笍
});
@HazAT
Found out new details. Please analyze the situation
If in sentry config to use the domain
defaults.url=https://sentry.io/
Everything works fine
If you use a company domain
defaults.url=https://sentrylogs.mycompany.com/
Then on only Android 9 it does not work (works fine iOS, Android 8)
The test was conducted on a simple application
@MacKentoch
Good work!!
Can confirm crash logs are not being sent properly when id in setUser is an integer on 1.0.6.
Same here. Thanks to @MacKentoch for the workaround!
It seems that this is the same as #695.
Closing this in favor of: https://github.com/getsentry/sentry-react-native/issues/695
Most helpful comment
I found the origin of the crash and a workaround (at least for my case).