Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Service shows panic message when i send custom message by endpoint '/msg/send_msg' #738

Closed
yfPanne opened this issue Aug 1, 2023 · 2 comments
Assignees
Labels
bug Categorizes issue or PR as related to a bug.

Comments

@yfPanne
Copy link

yfPanne commented Aug 1, 2023

What happened?

I tested sending custom messages, but it failed and caused an error on the server. I have already set the "content" field according to the prompt returned by the request, which needs to follow "CustomElem".
Service error message:

2023/08/01 10:29:07 [Recovery] 2023/08/01 - 10:29:07 panic recovered:
interface conversion: interface {} is nil, not string
/usr/local/go/src/runtime/iface.go:262 (0x40d689)
/Open-IM-Server/internal/api/msg.go:58 (0xf51228)
/Open-IM-Server/internal/api/msg.go:212 (0xf51ec5)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xf4dc24)
/Open-IM-Server/pkg/common/mw/gin.go:107 (0xf4d8fc)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xf4d3cd)
/Open-IM-Server/pkg/common/mw/gin.go:50 (0xf4d3b9)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xf4d20d)
/Open-IM-Server/pkg/common/mw/gin.go:34 (0xf4d1f9)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x97b281)
/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x97b26c)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x97a0b0)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 (0x979d18)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 (0x97985c)
/usr/local/go/src/net/http/server.go:2947 (0x6e7f0b)
/usr/local/go/src/net/http/server.go:1991 (0x6e3126)
/usr/local/go/src/runtime/asm_amd64.s:1594 (0x470420)

The information sent to /msg/send_msg through postman:

{
  "sendID": "1684367366441406464",
  "recvID": "1685906179542224896",
  "groupID": "",
  "senderNickname": "pan",
  "senderFaceURL": "http://www.pan.com",
  "senderPlatformID": 7,
  "content": {
    "data": "123",
    "extension": "a",
    "description": "v"
  },
  "contentType": 110,
  "sessionType": 1,
  "isOnlineOnly": false,
  "notOfflinePush": false,
  "offlinePushInfo": {
    "title": "send message",
    "desc": "",
    "ex": "",
    "iOSPushSound": "default",
    "iOSBadgeCount": true
  }
}

What did you expect to happen?

I hope the recipient can receive the customized message normally.

How can we reproduce it (as minimally and precisely as possible)?

Try to call endpoint /msg/send_msg and set contentType as 110.
Also should set content as the struct like:

  "content": {
    "data": "123",
    "extension": "a",
    "description": "v"
  }

Anything else we need to know?

I deploy it by docker-compose.
open-im-server image is openim/open_im_server:v3.0.1

version

$ {name} version
v3.0.1

Cloud provider

Tencent

OS version

# On Linux:
$ cat /etc/os-release
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ uname -a
Linux VM-4-16-debian 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux

Install tools

docker compose
@yfPanne yfPanne added the bug Categorizes issue or PR as related to a bug. label Aug 1, 2023
@yfPanne
Copy link
Author

yfPanne commented Aug 3, 2023

@wangchuxiao-dev Is there anything helpful please?

@yfPanne
Copy link
Author

yfPanne commented Aug 21, 2023

This bug was fixed in version 3.2.

@yfPanne yfPanne closed this as completed Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants