JS SDK Swallowing Errors

We are using the Sendbird JS SDK to build chat functionality for a multi-tenant application. In addition to the users being able to switch organizations (app id), we also have multiple ways to access chat (mobile and web app).

I have implemented the following code to check for unread messages:

let sb = SendbirdChat.init({
    // sendbird is not recognizing the appId unless it is uppercase
    // and the db is converting to lowercase
    appId: auth.sendbirdAppId.toUpperCase(),
    modules: [new GroupChannelModule()],

await sb.disconnect();
await sb.connect(auth.currentMembership.id, sendbirdCookie);

const messageCount = await sb.groupChannel.getTotalUnreadMessageCount();

const userEventHandler: UserEventHandler = new UserEventHandler({
    onTotalUnreadMessageCountUpdated: (totalCount: number) => {
        if (totalCount > 0) {
            const audio = new Audio(chatNotification);
            audio.play().catch(() => {
                // fail silently due to autoplay restrictions
        return setUnreadMessages(totalCount);

    auth?.currentMembership?.id || '',

The reason for using disconnect() came from this discussion.

However, recently when calling disconnect() or connect() the code is throwing an error (not continuing to execute) that is not surfaced. I have also seen quite a few unable to connect and timeout errors from the SDK. This had not been happening until late last week.

I have tried to remove disconnect(), but the issues still persist.

Any advice would be appreciated.

[SDK Version]

[Reproduction Steps]
See above

About 50% of the time

[Current impact]
We are unable to roll out chat to our users until this is rectified.

Hello @Rob_Lewis, Welcome to Sendbird Community.

Can you please tell us from when the issue occurred and also share the application id via personal message?

I started to notice it last week. Right around Wednesday. I’ll DM you with the appID.

As an update, the SDK is not swallowing the errors. It looks like it’s timing out. I was not waiting long enough for the error to end up in my catch block.

I was also running the SendbirdChat.init multiple times in the app. I am now checking to see if I have an instance before init. However, I still get the same error.

In addition to the timeout error, there is a connection canceled error.


We recommend not creating a new SB instance right away. Instead, please ensure that the previous instance is not being used by checking if a user is connected via module:sendbird - Documentation. If a user is connected, please disconnect them before destroying the old SB instance and then build a new one before connecting to a new user.

Also, could you please add error handling with try-catch blocks and share us with the exact error codes if you still face issues.

After trying your suggestion, I’m still encountering errors.

To test that it’s not something project-specific, I did the following:

  • Created a brand new react app
  • Install the React-UI kit package
  • Made a simple page with just the <SendbirdApp> component
  • Passed in appId, userId, accessToken, and config={{ logLevel: "debug" }}

All properties passed into the component I retrieved directly from https://dashboard.sendbird.com/

Code Minus Sensitive Data (properties)

import SendbirdApp from "@sendbird/uikit-react/App";
import "@sendbird/uikit-react/dist/index.css";

export default function Home() {
  return (
    <main className="flex flex-grow h-[100vh] min-h-screen flex-col items-center justify-between ">
        config={{ logLevel: "debug" }}

I get the following error on load:

 SendbirdUIKit | error | 2023-08-18T14:34:16.556Z | SendbirdProvider | useConnect/setupConnection/Connection failed. 800190 Connection timeout. |


It appears that your Sendbird application is set up to only allow access from certain domains. Could you verify that you have properly configured the domain and port for your UIKit application as per the configuration in Sendbird dashboard?

If the problem persists, please send me the user_id through DM.