# 3.1.2 Admin msg causing error

**URL:** <https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489>\
**Category:** JavaScript\
**Tags:** react-js, chatsdk\
**Created:** [December 6, 2021, 1:55pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489 "2021-12-06T13:55:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![developer](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@developer](https://community.sendbird.com/u/developer)\
**Post date:** [December 6, 2021, 1:55pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/1 "2021-12-06T13:55:39Z")

</div>

Hi,  
I’m using latest “sendbird-uikit”: “2.5.0” for React.  
And I believe sendbird-uikit is using SendBird-SDK-JavaScript v.3.1.2

When sending ‘Admin message’ - chat is causing error:

> TypeError: Cannot read properties of undefined (reading ‘userId’)

It’s line number 7389:  
`var r = n.memberMap[this._sender.userId];`

I’ve checked with SendBird-SDK-JavaScript v.3.0.160 - and everything was fine. Looks like some recent changes in library - are causing this new error. Screenshots attached.

 ![S7TDzqeHMQNv8g5hhjiD](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/3/3cf82f08bfea624293bb06bb721f130d68367422.png)

 ![ARHIdEpMJ7CBfzLjl34p](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/8/8963e7ec3d2fedc0678c95b1577396f760d1a4c3.png)

---

<div class="post-metadata">

**Author:** ![cole](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/cole/32/1826_2.png) [@cole](https://community.sendbird.com/u/cole)\
**Post date:** [December 6, 2021, 9:04pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/2 "2021-12-06T21:04:57Z")

</div>

We are having the exact same error, and nothing has worked. This has become a huge blocker.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [December 6, 2021, 9:06pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/3 "2021-12-06T21:06:44Z")

</div>

Hi @cole and @developer,

Can you both confirm which version of the Sendbird SDK is installed by looking at the package-lock.json?

I’ll happily take a look at what is going on.

---

<div class="post-metadata">

**Author:** ![cole](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/cole/32/1826_2.png) [@cole](https://community.sendbird.com/u/cole)\
**Post date:** [December 6, 2021, 9:18pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/4 "2021-12-06T21:18:31Z")

</div>

The broken version is SendBird-SDK-JavaScript v.3.1.2, which is the latest. It works when manually installed SendBird-SDK-JavaScript v.3.0.160.

---

<div class="post-metadata">

**Author:** ![developer](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@developer](https://community.sendbird.com/u/developer)\
**Post date:** [December 7, 2021, 10:41am UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/5 "2021-12-07T10:41:24Z")

</div>

Hi @Tyler  
In my package.json I have:

```auto
"sendbird-uikit": "2.5.0",

```

My package-lock.json includes:

```auto

    "sendbird": {
      "version": "3.1.2",
      "resolved": "https://registry.npmjs.org/sendbird/-/sendbird-3.1.2.tgz",
      "integrity": "sha512-vwrbS0ublFgyvJLl0qUTevH/03VYH/0/c1qG8xHB0ofYvdF0ozqZESL0SM8LGkhVo5neogi2zb07+kd2uuaCJw==",
      "requires": {
        "agentkeepalive": "4.1.4",
        "axios": "^0.21.4",
        "form-data": "^4.0.0",
        "ws": "^7.5.5"
      },
      "dependencies": {
        "form-data": {
          "version": "4.0.0",
          "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
          "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
          "requires": {
            "asynckit": "^0.4.0",
            "combined-stream": "^1.0.8",
            "mime-types": "^2.1.12"
          }
        },
        "ws": {
          "version": "7.5.6",
          "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz",
          "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==",
          "requires": {}
        }
      }
    },
    "sendbird-uikit": {
      "version": "2.5.0",
      "resolved": "https://registry.npmjs.org/sendbird-uikit/-/sendbird-uikit-2.5.0.tgz",
      "integrity": "sha512-P7knRFX/XuoZY2EWX5iZLIz/y5PyWtAD0ksoS8Xr8Va1hJhD5EIF8GR99fmuspUDFlxj6sJ8fCu25RDNYIxzgA==",
      "requires": {
        "css-vars-ponyfill": "^2.3.2",
        "date-fns": "^2.16.1",
        "prop-types": "^15.7.2",
        "react": "^16.8.6 || ^17.0.0",
        "react-dom": "^16.8.6 || ^17.0.0",
        "sendbird": "^3.0.160"
      }
    },

```

Also attached screenshot - where the error + SDK version is visible in file comment.

 ![vM24eStwfiahaX2d56QB](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/c/c3ced2f8bad251da4681051f304ee4c28302c039.png)

---

<div class="post-metadata">

**Author:** ![Reagan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/reagan/32/1100_2.png) [@Reagan](https://community.sendbird.com/u/Reagan)\
**Post date:** [December 7, 2021, 5:10pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/6 "2021-12-07T17:10:38Z")

</div>

We’re seeing this as well on `3.1.0` and above. Any channel with Admin messages will trigger a fatal error and break the page

---

<div class="post-metadata">

**Author:** ![Reagan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/reagan/32/1100_2.png) [@Reagan](https://community.sendbird.com/u/Reagan)\
**Post date:** [December 7, 2021, 5:40pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/7 "2021-12-07T17:40:47Z")

</div>

```javascript
export const isSameGroup = (message, comparingMessage) => {
  if (
    !message
    || !comparingMessage
    || !message.sender
    || !comparingMessage.sender
    || !message.createdAt
    || !comparingMessage.createdAt
    || !message.sender.userId
    || !comparingMessage.sender.userId
  ) {
    return false;
  }
  return (
    message.sendingStatus === comparingMessage.sendingStatus
    && message.sender.userId === comparingMessage.sender.userId
    && getMessageCreatedAt(message) === getMessageCreatedAt(comparingMessage)
  );
};

```

`isSameGroup` is assuming all messages have a `sender` attribute. This is not true for `AdminMessages` as seen in the type definitions. Is Sendbird not using its own type definitions for static validation?

```javascript
interface AdminMessage extends BaseMessageInstance {
  messageType: 'admin';
  message: string;
  translations: Object;
}

interface UserMessage extends BaseMessageInstance {
  messageType: 'user';
  message: string;
  sender: Sender;
  reqId: string;
  ...
}

```

---

<div class="post-metadata">

**Author:** ![Robert\_Mruczek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/robert_mruczek/32/691_2.png) [@Robert\_Mruczek](https://community.sendbird.com/u/Robert_Mruczek)\
**Post date:** [December 13, 2021, 3:40pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/8 "2021-12-13T15:40:31Z")

</div>

FYI this is still an issue with `3.1.3`:

 ![Screen Shot 2021-12-13 at 10.40.12 AM](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/8/86b72ad2f6c5b39b31ff0611921acec64b7cf45b.png)

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [December 13, 2021, 4:26pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/9 "2021-12-13T16:26:52Z")

</div>

ETA for fix is EoD of 12/14 KST.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [December 14, 2021, 2:56pm UTC](https://community.sendbird.com/t/3-1-2-admin-msg-causing-error/3489/10 "2021-12-14T14:56:07Z")

</div>

The fix was released in JS SDK 3.1.4 and UIKit 2.5.1
