Cannot connect to the sendbird server using Sendbird React Native UIKIT useConnection hook

We are facing difficulty while working with Sendbird React Native UIKIT. So, we are trying to connect to the Sendbird server using the useConnection hook provided by Sendbird react native uikit. It gives us an error with a status code of 800120.

The steps that we have followed are:

  1. Wrapping of our app in the SendbirdUiKitContainer
<SendbirdUIKitContainer
              appId="F53DF97C-E104-4603-A396-8FC7DB7BB37A"
              chatOptions={{ localCacheStorage: AsyncStorage }}
              platformServices={{
                file: FileService,
                notification: NotificationService,
                clipboard: ClipboardService,
                media: MediaService,
              }}
            >
              // our app
            </SendbirdUIKitContainer>
  1. and then connecting to the Sendbird server.
  const onPressChatWithUs = async () => {
    console.log("before connection");
    try {
      const response = await connect("097094", {
        nickname: "Yuvraj",
        accessToken: "24ef5e8e34e1da4bab36ff8605bdc3cbf02b45a6",
      });
      console.log("after successful connection", response);
      navigation.navigate("GroupChannelList");
    } catch (error) {
      console.log(error);
    }
  };

When onPressChatWithUs is triggered, then it first consoles “before connection” as expected, and after a pause of 9-10 seconds throws an error with a status code of 800120. The snapshot depicting the same is attached below.

SDK versions that we have used are:

    "@sendbird/chat": "^4.6.0",
    "@sendbird/uikit-react-native": "^2.4.1",

When searching for the error code, it shows:

The connection failed due to the unstable network or an unexpected error in the Chat SDK network library.

We have followed each step mentioned on https://sendbird.com/docs/uikit/v3/react-native/introduction/send-first-message#1-send-your-first-message precisely

Can someone please assist us to resolve this issue?

1 Like

Update:

It works fine on real device, however on emulator it throws the same error that too with a delay of atleast 9-10 seconds.

Hello @Namrata_Jain,

Welcome to the Sendbird Community.

If it works fine on a real device, it seems to be that there may be an issue with the emulator and it’s connection out to Sendbird causing it to take too long. Are you able to capture any network traffic to see when the request is made and when it gets a response (if at all)?