Sentry-react-native: not working on Android 9 (release apk)

Created on 6 Sep 2019  路  8Comments  路  Source: getsentry/sentry-react-native

OS:

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

_Platform:_

  • [ ] iOS
  • [x] Android

SDK:

  • [x] @sentry/react-native
  • [ ] react-native-sentry

react-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:

  • Step
    build simple application in Android Studio (release.apk)

Actual result:

  • Actual
    Sentry no catching crush or messages

url to repo (simple app)
https://bitbucket.org/webforuse/sandbox/src/master/

Most helpful comment

I found the origin of the crash and a workaround (at least for my case).

The origin is setUser method that does not support anything else than string for data (my case I just needed id).

Sentry.setUser({
   id: SOME_ID, // will crash if id is not a string, ex: a number will crash 鈥硷笍
});

All 8 comments

Same issue.

My context:

  • Crash on Android 9 simulator (signed release build)
  • works without issue on iOS
  • "@sentry/react-native": "^1.0.4"
  • "react": "16.8.6",
  • "react-native": "0.60.5",
  • NOTE: with or without Hermes does not change anything
    here is my logcat:
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 setUser method that does not support anything else than string for data (my case I just needed id).

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.

Was this page helpful?
0 / 5 - 0 ratings