# \[React Native\] TypeError: undefined is not an object (evaluating 'Vn.of(this.\_iid).fetch')

**URL:** <https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895>\
**Category:** JavaScript\
**Tags:** chatsdk, react-native\
**Created:** [June 15, 2022, 12:02pm UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895 "2022-06-15T12:02:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jabir\_Muhammad](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jabir_muhammad/32/2302_2.png) [@Jabir\_Muhammad](https://community.sendbird.com/u/Jabir_Muhammad)\
**Post date:** [June 15, 2022, 12:02pm UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/1 "2022-06-15T12:02:54Z")

</div>

I am using v4 JS SDK with React Native.

```auto
{
   "@sendbird/chat": "^4.0.0",
   "react-native": "0.67.3"
}

```

Can you help me with this error?  
I am getting this error while trying to call `sb.connect()`

```auto
TypeError: undefined is not an object (evaluating 'Vn.of(this._iid).fetch')

```

  

following is my code snippet

```auto
   const sendbird = SendbirdChat.init({
      appId: SENDBIRD_CHAT_APP_ID,
      modules: [new OpenChannelModule()],
      logLevel: LogLevel.DEBUG,
    });

    const user = await sendbird.connect(profileData.id);

```

---

<div class="post-metadata">

**Author:** ![Jason](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jason/32/488_2.png) [@Jason](https://community.sendbird.com/u/Jason)\
**Post date:** [June 24, 2022, 8:11pm UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/2 "2022-06-24T20:11:47Z")

</div>

@Jabir_Muhammad Hi there. Please can you share the wider context of your code? I’m interested to see your sendbird imports and also the async function you are wrapping your await statement with.

Also is the file type you are writing in .js or .ts?

---

<div class="post-metadata">

**Author:** ![Jabir\_Muhammad](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jabir_muhammad/32/2302_2.png) [@Jabir\_Muhammad](https://community.sendbird.com/u/Jabir_Muhammad)\
**Post date:** [June 27, 2022, 5:41am UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/3 "2022-06-27T05:41:29Z")

</div>

@Jason Hi,  
I am connecting to sendbird using react Context `ChatContext.tsx`

```auto
import SendbirdChat, { LogLevel } from '@sendbird/chat';
....

const connectSendbird = useCallback(async ()=>{

    const sendbird = SendbirdChat.init({
      appId: SENDBIRD_CHAT_APP_ID,
      modules: [new OpenChannelModule()],
      logLevel: LogLevel.DEBUG,
    });

    sendbirdRef.current = sendbird;
   
    try {
       const user = await sendbird.connect(profileData?.id || '');
       console.log('sendBird:connectedUser', user);
    } catch(error){
       console.error('sendBird:connectedUserError', error);
    }

},[profileData])

```

---

<div class="post-metadata">

**Author:** ![Jason](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jason/32/488_2.png) [@Jason](https://community.sendbird.com/u/Jason)\
**Post date:** [June 27, 2022, 11:19am UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/4 "2022-06-27T11:19:12Z")

</div>

@Jabir_Muhammad Hi there. Thanks for the code snippet.

Please can I double check that you import the [OpenChannelModule](https://sendbird.com/docs/chat/v4/javascript/getting-started/send-first-message#2-get-started-3-step-2-initialize-sendbird-chat-sdk)?

`import { OpenChannelModule } from '@sendbird/chat/openChannel';`

---

<div class="post-metadata">

**Author:** ![Jabir\_Muhammad](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jabir_muhammad/32/2302_2.png) [@Jabir\_Muhammad](https://community.sendbird.com/u/Jabir_Muhammad)\
**Post date:** [June 27, 2022, 11:31am UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/5 "2022-06-27T11:31:46Z")

</div>

@Jason Yeah, I have imported OpenChannel Module like that.

```auto
import { OpenChannelModule, OpenChannelHandler, OpenChannel } from '@sendbird/chat/openChannel';

```

---

<div class="post-metadata">

**Author:** ![kavindu\_tinto](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kavindu_tinto/32/2697_2.png) [@kavindu\_tinto](https://community.sendbird.com/u/kavindu_tinto)\
**Post date:** [June 27, 2022, 11:36am UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/6 "2022-06-27T11:36:19Z")

</div>

Having the exact problem as @Jabir_Muhammad .

---

<div class="post-metadata">

**Author:** ![Jason](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jason/32/488_2.png) [@Jason](https://community.sendbird.com/u/Jason)\
**Post date:** [June 28, 2022, 1:56am UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/7 "2022-06-28T01:56:55Z")

</div>

@Jabir_Muhammad @kavindu_tinto Hi there. I trust you are both well.

Sendbird’s engineers have been working to fix the above issue. Please can you install the latest version of the JS SDK. As of writing that would be v4.0.3. 🙂

> **[Release v4.0.3 · sendbird/sendbird-chat-sdk-javascript](https://github.com/sendbird/sendbird-chat-sdk-javascript/releases/tag/v4.0.3)**
>
> Fixed bug: Crash on using OpenChannelModule alone.

---

<div class="post-metadata">

**Author:** ![kavindu\_tinto](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/kavindu_tinto/32/2697_2.png) [@kavindu\_tinto](https://community.sendbird.com/u/kavindu_tinto)\
**Post date:** [June 28, 2022, 8:38am UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/8 "2022-06-28T08:38:37Z")

</div>

@Jason I can confirm that this specific issue has been fixed. Thank you for the update.

---

<div class="post-metadata">

**Author:** ![Jabir\_Muhammad](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jabir_muhammad/32/2302_2.png) [@Jabir\_Muhammad](https://community.sendbird.com/u/Jabir_Muhammad)\
**Post date:** [June 29, 2022, 6:56am UTC](https://community.sendbird.com/t/react-native-typeerror-undefined-is-not-an-object-evaluating-vn-of-this-iid-fetch/4895/9 "2022-06-29T06:56:23Z")

</div>

@Jason Thanks, v4.0.3 fixes this specific issue. But I have another problem with disconnect. Please check my new thread.

> [@\[React Native\] Disconnect error in v4](https://community.sendbird.com/t/react-native-disconnect-error-in-v4/4973):
>
> I am using v4 JS SDK with React Native. { "@sendbird/chat": "^4.0.3", "react-native": "0.68.2" } I am getting the following error while trying to call sb.disconnect() [TypeError: window.removeEventListener is not a function. (In 'window.removeEventListener("visibilitychange", this.\_toggleState.bind(this), { capture: !0 })', 'window.removeEventListener' is undefined)] my code snippet const disconnectSendbird = useCallback(() =\> { if (sendbirdChannelRef.current) { …
