Search code examples
reactjstwiliotwilio-programmable-chattwilio-video

Error: There was a problem getting the Conversation associated with this room


I'm trying to implement this project: https://github.com/twilio/twilio-video-app-react

I got error "There was a problem getting the Conversation associated with this room." when the ChatProvider did mount. Seem like chatClient can't find the conversation with room.sid but I can't figure out how to create conversation when it doesn't exist and add participants when conversation existed. Does anyone know this issue? Thanks!

Update: the server code: https://gist.github.com/qngnud/c9910afada625a9a4eceb3ad3a67d3b7


Solution

  • Twilio developer evangelist here.

    It appears that you are using similar code to the original app in your server, however you have missed a crucial keyword.

    The part of the code where you try to fetch a conversation by the room.sid is surrounded by a try/catch, however it is called in promise form, so any failures will be picked up by a chained .catch() function.

    In the original code, the calls are made using the await keyword which turns promises into code that appears synchronous and, most importantly, in which errors can be caught by a try/catch block.

    So, you should either move your catch blocks to .catch() promise chains, or declare the whole function async and use await before the asynchronous function calls.