openimsdk / open-im-server

IM Chat ChatGPT
https://openim.io
Apache License 2.0
14.11k stars 2.49k forks source link

[BUG] jpush offlinePushMsg failed #2706

Closed EDaoren closed 6 days ago

EDaoren commented 1 month ago

OpenIM Server Version

3.8.0

Operating System and CPU Architecture

Linux (AMD)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

我配置了jpush的离线推送,并没有成功,有以下问题: openim-push.yml 配置文件 `#Use geTui for offline push notifications, or choose fcm or jpns; corresponding configuration settings must be specified. enable: jpns geTui: pushUrl: https://restapi.getui.com/v2/$appId masterSecret: appKey: intent: channelID: channelName: fcm:

Prioritize using file paths. If the file path is empty, use URL

filePath: # File path is concatenated with the parameters passed in through - c(mage default pass in config/) and filePath. authURL: # Must start with https or http. jpns: appKey: xxxxxx masterSecret: xxxxxxx pushURL: xxxxxx pushIntent: `

按照配置文件注释的提示,我配置 enable 以及相关的 appKey 和 masterSecret,发现推送的时候并没有反应, 查看源代码发现如下: `const ( geTUI = "geTui" firebase = "fcm" jPush = "jpush" )

func NewOfflinePusher(pushConf *config.Push, cache cache.ThirdCache, fcmConfigPath string) (OfflinePusher, error) { var offlinePusher OfflinePusher log.Print("使用什么推送(pushConf.Enable):", pushConf.Enable) switch pushConf.Enable { case geTUI: offlinePusher = getui.NewClient(pushConf, cache) case firebase: return fcm.NewClient(pushConf, cache, fcmConfigPath) case jPush: offlinePusher = jpush.NewClient(pushConf) default: offlinePusher = dummy.NewClient() } return offlinePusher, nil } ` 按照配置文件注释,enable = ‘jpns’,switch 判断逻最终会走 default,没有走jpush,我修改配置文件 enable = ‘jpush’,正常走jpush逻辑了,也发起jpush推送了,但推送并没有成功推送。

日志异常信息如下: 2024-10-10 18:40:27.607 DEBUG [PID:126238] openim-push [version:3.8.0] [jpush/push.go:56] 执行极光推送------------ {"platform": "Web", "connID": "856ab48d22c5a6b99ccaab2ddf80c5c7", "operationID": "659f1035-2602-443b-9d51-a1eeea3d1ab6", "opUserID": "3373149053"} 2024-10-10 18:40:27.854 WARN [PID:126238] openim-push [version:3.8.0] [push/push_handler.go:178] offlinePushMsg failed {"platform": "Web", "connID": "856ab48d22c5a6b99ccaab2ddf80c5c7", "operationID": "659f1035-2602-443b-9d51-a1eeea3d1ab6", "opUserID": "3373149053", "offlinePushUserID": ["222581\"3373149053\" recvID:\"2225814255\" clientMsgID:\"81457366bba5d3d4a4dd1c3d21e883df\" serverMsgID:\"f93cb24962f15bb31ee5b5256447e69e\" senderPlatformID:5 senderNickname:\"chen\" 100 contentType:101 content:\"{\\\"content\\\":\\\"1111\\\"}\" seq:8 sendTime:1728556827517 createTime:1728556827795 status:1 offlinePushInfo:{title:\"你有一条新消息\" iOSPushSunt:true} attachedInfo:\"null\"", "error": "JSON unmarshal failed: json: Unmarshal(nil)"}

我go语言不太熟悉,请问这是什么问题?

Screenshots Link

image

OpenIM-Robot commented 1 month ago

Hello! Thank you for filing an issue.

If this is a bug report, please include relevant logs to help us debug the problem.

Join slack 🤖 to connect and communicate with our developers.

FGadvancer commented 1 month ago

If your discovery.yaml configuration uses ZooKeeper, it is recommended to switch to etcd.

wikylyu commented 6 days ago

我也遇到一样的问题,我怀疑是对接jpush的接口时数据格式出错了

OpenIM-Robot commented 6 days ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I also encountered the same problem. I suspected that the data format was wrong when connecting to the jpush interface.

skiffer-git commented 6 days ago

enable: jpush