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.
Hi
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?
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
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!
Thanks for your help!
Reply
Join the Intercom Community 🎉
Already have an account? Login
Login to the community
No account yet? Create an account
Intercom Customers and Employees
Log in with SSOEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.