# Chat SDK v4 migration issues

**URL:** <https://community.sendbird.com/t/chat-sdk-v4-migration-issues/4489>\
**Category:** JavaScript\
**Tags:** chatsdk\
**Created:** [April 20, 2022, 7:24am UTC](https://community.sendbird.com/t/chat-sdk-v4-migration-issues/4489 "2022-04-20T07:24:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hewong](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/hewong/32/1817_2.png) [@hewong](https://community.sendbird.com/u/hewong)\
**Post date:** [April 20, 2022, 7:24am UTC](https://community.sendbird.com/t/chat-sdk-v4-migration-issues/4489/1 "2022-04-20T07:24:27Z")

</div>

Originally posted this under [this topic](https://community.sendbird.com/t/sendbird-chat-typescript-issues/4469/2). As we discover more issues, we decided open a separate topic.

We are experiencing a similar issue with `sb.groupChannel`, our workaround is to cast `SendbirdChat.init() as SendbirdGroupChat`

By the way, I got this warning while installing the package using yarn, not sure if it’s related

```auto
warn Package @sendbird/chat has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/<path-to-my-app>/node_modules/@sendbird/chat/package.json

```

Other than that, so far we realised that in v4 we can’t do type narrowing on messages using `messageType` anymore unlike in v3

---

<div class="post-metadata">

**Author:** ![hewong](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/hewong/32/1817_2.png) [@hewong](https://community.sendbird.com/u/hewong)\
**Post date:** [April 20, 2022, 8:13am UTC](https://community.sendbird.com/t/chat-sdk-v4-migration-issues/4489/2 "2022-04-20T08:13:00Z")

</div>

Importing from `@sendbird/chat/groupChannel` or `@sendbird/chat/openChannel` throws this error, even after removing `node_modules`, re-installing and resetting cache.

```auto
error: Error: Unable to resolve module @sendbird/chat/groupChannel from /Users/<path-to-my-app>/app/modules/chat/src/Sendbird.ts: @sendbird/chat/groupChannel could not be found within the project or in these directories:
  node_modules

```

---

<div class="post-metadata">

**Author:** ![Peter\_Cheng](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/peter_cheng/32/1814_2.png) [@Peter\_Cheng](https://community.sendbird.com/u/Peter_Cheng)\
**Post date:** [April 22, 2022, 7:36pm UTC](https://community.sendbird.com/t/chat-sdk-v4-migration-issues/4489/3 "2022-04-22T19:36:58Z")

</div>

Facing same issue before. i added package.json at sub module dir as workaround.  
refs [Feature: support new package.json exports field · Issue #670 · facebook/metro · GitHub](https://github.com/facebook/metro/issues/670)

```auto
diff --git a/node_modules/@sendbird/chat/groupChannel/package.json b/node_modules/@sendbird/chat/groupChannel/package.json
new file mode 100644
index 0000000..3072a6e
--- /dev/null
+++ b/node_modules/@sendbird/chat/groupChannel/package.json
@@ -0,0 +1,22 @@
+{
+ "version": "4.0.0-beta-2",
+ "description": "Sendbird SDK for JavaScript",
+ "name": "@sendbird/chat",
+ "author": "Sendbird <support@sendbird.com>",
+ "keywords": [
+ "sendbird",
+ "sendbird.com",
+ "messaging",
+ "chat",
+ "js"
+ ],
+ "license": "SEE LICENSE IN LICENSE.md",
+ "homepage": "https://sendbird.com",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/sendbird/sendbird-chat-sdk-javascript"
+ },
+ "type": "module",
+ "main": "../bundles/groupChannel.js",
+ "types": "../types/groupChannel.d.ts"
+}
diff --git a/node_modules/@sendbird/chat/message/package.json b/node_modules/@sendbird/chat/message/package.json
new file mode 100644
index 0000000..95e9a3c
--- /dev/null
+++ b/node_modules/@sendbird/chat/message/package.json
@@ -0,0 +1,22 @@
+{
+ "version": "4.0.0-beta-2",
+ "description": "Sendbird SDK for JavaScript",
+ "name": "@sendbird/chat",
+ "author": "Sendbird <support@sendbird.com>",
+ "keywords": [
+ "sendbird",
+ "sendbird.com",
+ "messaging",
+ "chat",
+ "js"
+ ],
+ "license": "SEE LICENSE IN LICENSE.md",
+ "homepage": "https://sendbird.com",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/sendbird/sendbird-chat-sdk-javascript"
+ },
+ "type": "module",
+ "main": "../bundles/message.js",
+ "types": "../types/message.d.ts"
+}
diff --git a/node_modules/@sendbird/chat/openChannel/package.json b/node_modules/@sendbird/chat/openChannel/package.json
new file mode 100644
index 0000000..3072a6e
--- /dev/null
+++ b/node_modules/@sendbird/chat/openChannel/package.json
@@ -0,0 +1,22 @@
+{
+ "version": "4.0.0-beta-2",
+ "description": "Sendbird SDK for JavaScript",
+ "name": "@sendbird/chat",
+ "author": "Sendbird <support@sendbird.com>",
+ "keywords": [
+ "sendbird",
+ "sendbird.com",
+ "messaging",
+ "chat",
+ "js"
+ ],
+ "license": "SEE LICENSE IN LICENSE.md",
+ "homepage": "https://sendbird.com",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/sendbird/sendbird-chat-sdk-javascript"
+ },
+ "type": "module",
+ "main": "../bundles/groupChannel.js",
+ "types": "../types/groupChannel.d.ts"
+}

```

---

<div class="post-metadata">

**Author:** ![hewong](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/hewong/32/1817_2.png) [@hewong](https://community.sendbird.com/u/hewong)\
**Post date:** [April 24, 2022, 2:41am UTC](https://community.sendbird.com/t/chat-sdk-v4-migration-issues/4489/4 "2022-04-24T02:41:39Z")

</div>

Thanks for that, I’ll give it a try

---

<div class="post-metadata">

**Author:** ![TJL](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tjl/32/3605_2.png) [@TJL](https://community.sendbird.com/u/TJL)\
**Post date:** [February 23, 2023, 8:46pm UTC](https://community.sendbird.com/t/chat-sdk-v4-migration-issues/4489/5 "2023-02-23T20:46:27Z")

</div>

@Miyoung_Han, any update on this?
