Fatal Exception in Release versions of iOS/Android App

Hello,

We’ve started using version 4 (4.0.7) of Chat SDK in our React Native application. During development everything was working great, but when we’re trying to run Release version of iOS/Android app, it’s crashing right away.

So after debugging, I’ve found out that error comes from Sendbird library

And according to generated sourcemaps, it shows that this file is responsible for that:

{
  source: '/Users/.../node_modules/@sendbird/chat/__bundle-3cbfe38b.js',
  line: 15,
  column: 34055,
  name: 'n'
}

And after renaming this nested function name to something else, issue occurs also here:

{
  source: '/Users/.../node_modules/@sendbird/chat/__bundle-3cbfe38b.js',
  line: 15,
  column: 94420,
  name: 'n'
}

And after fixing this one too, everything works fine.

So is there any other way how this issue can be solved? Or can it be solved by you somehow?

Thanks in advance!

Hi @mz.dlabs,

Welcome to the Sendbird Community.

I’m not sure if I understand how you say you’ve fixed this problems so its hard for me to understand what’s really happening. Could you expand your solution?

So for exemple issue is caused by this line in bundled file:

Jt=function(e){function n(t,n,r){var i,s,o,a=this;(a=e.call(this,t,"FILE",r)||this).message=new Wt(t,r);var u=St.of(t).sdkState;return a.isMentioned=Ye(a.message.mentionType,null!==(i=a.message.mentionedUserIds)&&void 0!==i?i:null===(s=a.message.mentionedUsers)||void 0===s?void 0:s.map((function(e){return e.userId})),u.userId),a.forceUpdateLastMessage=null!==(o=r.force_update_last_message)&&void 0!==o&&o,a}return t(n,e),n}

at the beggining theres function n(t,n,r), and it’s returned at the end of this code block. And this issue Can't find variable: n relates to this returned value at the end. After changing name of this function and using it at the end - everything works fine. So there’s probably issue with bundling those scripts.

Thank you for that. Also just to confirm, does this occur on both iOS and Android?
One additional ask, can you try upgrading to the newly released 4.0.8 and see if the issue still exists?

Yes, both Android and iOS. And app was compiled on 2 different computers.

Issue still exist in 4.0.8 version

Hello @Tyler ,

We’re getting exactly same issue on both iOS & Android release version, using @sendbird/chat 4.0.4.

Hey @Tyler, we’re experiencing this issue as well, on Android and iOS using chat sdk v4.04 with react native.

Thanks for looking into this, please let us know of any updates

Hi @Eueddem_Kim and @charles,

Since you’re with the same team, I’ll tag you together. Is the error exactly the same as the OP? Is it also only happening on release and not in development? Did it ever work on any version of V4?

Same error yes. ReferenceError · Can't find variable: n.

It was only happening in release and not development. And this is version (4.04) is the first version of v4 that we used it on.

Hello @Tyler ,

Do you have any updates here? Our release has been blocked for 2 weeks now.

Hello,

My apologies for the delay on this. Is there any chance you’re able to put together a sample application that creates this error? I tried building out a small application using our V4 SDK and building in release mode but have not yet been able to reproduce the error.

Hi all,

I believe we’ve answered this via a support case but I’ll also post it here. Our Engineering team did a deep dive on the topic and determined that this is no longer an issue when using React-Native v.065 or higher. This is a error within Metro Bundler (reference)

The Engineering team has created a sample project on how to patch this which you can find here: GitHub - bang9/v4-rn-patch: metro bundler patch

1 Like