1

I'm trying to use twilio conversations from javascript in React Native.

I'm getting RangeError: Maximum call stack size exceeded (native stack depth) when calling

const Conversations = require('@twilio/conversations');

Conversations.Client.create(token)

My package.json looks like

{
    "@twilio/conversations": "^1.2.2",
    "events": "^3.3.0",
    "react": "17.0.2",
    "react-native": "0.64.2",
    "react-native-navigation": "^7.16.0",
    "react-native-navigation-hooks": "^6.3.0",
    "react-native-twilio-video-webrtc": "https://github.com/blackuy/react-native-twilio-video-webrtc",
    "react-stomp": "^5.1.0",
  }

Here is the logs

1 Answers1

0

Twilio developer evangelist here.

Can you try importing the module with import instead of require? Like:

import {Client} from '@twilio/conversations';

Then you can see more debug information from the client if you change the logLevel when you create it:

Client.create(token, { logLevel: 'debug' });
philnash
  • 70,667
  • 10
  • 60
  • 88
  • Thanks for checking me out. I have added the logs file. – Tuy Sotheara Jul 26 '21 at 05:40
  • I can't reproduce the `RangeError`. Your logs also show that the conversations SDK is connecting successfully. When I searched for the error string, I found [this report](https://github.com/facebook/hermes/issues/135) that mentions including a large JSON file. Do you include any large files that require parsing as part of your application? – philnash Jul 26 '21 at 06:58
  • No, I do not include any large file. I agree that SDK is connecting successfully; however, without calling it will create no issue. I also use conversations as a combination with twilio video "react-native-twilio-video-webrtc". Is there any way I can check whether there is a large file is being parsed? – Tuy Sotheara Jul 26 '21 at 08:14
  • create() function also never returns me back the instance of chat client including no error message in try/catch – Tuy Sotheara Jul 26 '21 at 08:17
  • 1
    do you have any speculation which I can start digging in – Tuy Sotheara Jul 26 '21 at 08:18
  • `create` is asynchronous and returns a Promise that resolves to a client, not an instance of a client. – philnash Jul 26 '21 at 08:19
  • Could there be some issue with getting the bundler to install from GitHub? Can you just include `react-native-twilio-video-webrtc` version 2.0 from [npm](https://www.npmjs.com/package/react-native-twilio-video-webrtc)? – philnash Jul 26 '21 at 08:25
  • 1
    I managed to make it works by include "inlineRequires: false" in my metro.config.js Thanks for your supports. – Tuy Sotheara Jul 26 '21 at 08:55
  • Oh cool! Glad to hear something worked out! – philnash Jul 26 '21 at 08:57
  • @TuySotheara could you please update the accepted answer? your solution is hidden in the comment-dropdown. – Ele Apr 06 '22 at 12:38