Skip to main content
Answered

React native crash on Android for latest version 5.0.0


When calling the IntercomModule.loginUserWithUserAttributes without an email it crashes because the IntercomHelpers.getValueAsStringForKey(params, “email”); line here is being called even if there is no email and there is no null check in that method: https://github.com/intercom/intercom-react-native/blob/9623a0c4822e91949d27357ef21df845cc91f38f/android/src/main/java/com/intercom/reactnative/IntercomModule.java#L139 . Same this would happen if no userId was passed in. Both values are checked to see if they are there, but even if they are not it still attempts to get them rom the params. It can be bypassed by passing in an empty string, but that is not ideal.

Best answer by Albin

Update, I submitted a patch to fix this: https://github.com/intercom/intercom-react-native/pull/102
It’s now released as 5.1.1! https://github.com/intercom/intercom-react-native/commit/0ceb4a53c0bf8502d76fba0f4335b9f26b0471e4

Thanks!

View original
Did this topic help you find an answer to your question?

4 replies

Jacob Cox
Intercom Team
Forum|alt.badge.img+5
  • Sr. Technical Support Engineer
  • 441 replies
  • May 28, 2023

Hi @cody.roueche 

I have just a few questions to help confirm the situation that you’re running into.

You’re saying when you try logging a user in with the RN SDK’s Intercom.loginUserWithUserAttributes method with only a UserID, it crashes. This doesn’t happen when you include an email address or an empty string as the Email address, correct?

 

Your title says this is happening in Android. Have you tried implementing this in iOS as well? If so, does the same thing happen there?

 

Are you able to share your crash logs?


  • New Participant
  • 3 replies
  • May 31, 2023

@Jacob Cox I can confirm this issue. It happened to me too, I am running the official react-native integration, https://github.com/intercom/intercom-react-native
After upgrading to intercom SDK 5.0, my app crashes on android when i run loginUserWithUserAttributes with only userId, it works like before on iOS. 

If I send in an empty string on android, it doesn’t crash.

Here is the stacktrace:
 

com.facebook.react.bridge.NoSuchKeyException: email
    at com.facebook.react.bridge.ReadableNativeMap.getType(ReadableNativeMap.java:183)
    at com.intercom.reactnative.IntercomHelpers.getValueAsStringForKey(IntercomHelpers.java:227)
    at com.intercom.reactnative.IntercomModule.loginUserWithUserAttributes(IntercomModule.java:139)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
    at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
    at java.lang.Thread.run(Thread.java:1012)


The bug was introduced in this commit https://github.com/intercom/intercom-react-native/commit/505d1c0883b8928d28d29be3f3a03aa48023ea52​​


  • New Participant
  • 3 replies
  • Answer
  • May 31, 2023

  • Author
  • New Participant
  • 1 reply
  • June 8, 2023

Thanks for your help!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings