最近项目上使用了云数据库的watch功能,上线后大量报错 -402002:
realtime listener rebuild watch fail | errMsg: Error: Watch Error {"code":"QUERYID_INVALID_ERROR","message":"queryID not exist, need retry initWatch"}
realtime listener init watch fail | errMsg: init watch fail Error: invalid state: ws connection not exists, can not send message
另外,小程序运维中心的错误查询种监控到大量的错误:
current state (CLOSED) does not accept "initWatchFail"
current state (REBUILD_WATCH_SUCCESS) does not accept "rebuildWatchFail"
current state (CONNECTED) does not accept "connectionSuccess"
current state (DISCONNECTED) does not accept "connectionSuccess"
[realtime] onMessage parse res.data error: SyntaxError: Unexpected token u in JSON at position 0;at socketTask.onmessage callback function
我选取几个示例报错:
我使用到的代码如图:(代码中涉及到websocket的仅仅只有云数据的watch,并没有用到其他websocket功能和代码)
在我本人手机上和IDE上面都没有报过这样的错误,不知道是为什么?
请教一下,是什么原因导致的这种错误?有什么办法能解决?

2025年了,还是相同的问题
监听器错误 <Error: errCode: -402004 realtime listener rebuild watch fail | errMsg: Error: Watch Error {"code":"QUERYID_INVALID_ERROR","message":"queryID not exist, need retry initWatch"} (requestid: 1760756230247_0.04456018294314312) (rebuildWatch requestId 1760756230247_0.04456018294314312) history states: UNINIT-(loginStart)->INIT_LOGGING_IN-(loginSuccess)->INIT_LOGGED_IN-(initWatchStart)->INIT_WATCH_PENDING-(initWatchSuccess)->INIT_WATCH_SUCCESS-(wsDisconnected)->PAUSED-(loginStart)->REBUILD_LOGGING_IN-(loginSuccess)->REBUILD_LOGGED_IN-(rebuildWatchStart)->REBUILD_WATCH_PENDING-(close)->CLOSED> C@https://lib/WACloud.js:1:256083 i@https://lib/WACloud.js:1:386080 @https://lib/WACloud.js:1:389363 @https://lib/WACloud.js:1:386655 t@https://lib/WACloud.js:1:375 s@https://lib/WACloud.js:1:587 @https://lib/WACloud.js:1:646 M@https://lib/WASubContext.js:1:59358 @https://lib/WACloud.js:1:537 @https://lib/WACloud.js:1:385813 t@https://lib/WACloud.js:1:375 u@https://lib/WACloud.js:1:623 q@https://lib/WASubContext.js:1:58068 @https://lib/WASubContext.js:1:58294 C@https://lib/WASubContext.js:1:36140似乎不是移动端的报错~是PC端的,PC端的watch目前应该是不支持