刚刚好了没几天,又出现了这样的问题了,还是云开发数据库watch监听的bug,请官方管理员来看一下。
下面是6月12日发的求助内容:
昨天上午还好好的,晚上就报错了。调试了整晚,手机端还是这个错误。偏偏在微信开发者工具上是正常的。
这是由手机端监听云开发数据库引发的错误,我把监听函数注释掉,就不报这个错误信息了。
Uncaught (in promise) FrameworkError <TypeError: Cannot add property Map, object is not extensible>
<TypeError: Cannot add property Map, object is not extensible><div class="eruda-json eruda-hidden"></div>
at e.value (wagame://servicewechat.com/WAGameVConsole.html:27576:37895)
at new e (wagame://servicewechat.com/WAGameVConsole.html:27576:36659)
at t.value (wagame://servicewechat.com/WAGameVConsole.html:27576:32217)
at t.value (wagame://servicewechat.com/WAGameVConsole.html:27576:31461)
at f.e.<computed> [as error] (wagame://servicewechat.com/WAGameVConsole.html:27576:16382)
at wagame://servicewechat.com/WAGameVConsole.html:27576:19192
at Array.forEach (<anonymous>)
at console._log (wagame://servicewechat.com/WAGameVConsole.html:27576:19080)
at <anonymous>:1:9
代码片段:
var db = wx.cloud.database();
var watcher1 = db.collection('game_rooms');
//监听游戏房间玩家信息更新情况:
if (nowRoom.roomID != "" && G.inRoom == 1) {
console.log("nowRoom.roomID",nowRoom.roomID);
watcher1.where({
_id: nowRoom.roomID
}).watch({
onChange: function(snapshot) {
console.log('query result snapshot after the event', snapshot.docs);
// 监听游戏房间数据:玩家1,玩家2,的信息,在此房间的游戏得分,剩余时间
},
onError: function (err) {
console.error('the gameRoom watch1 closed because of error', err)
}
});
}
报错信息:
the gameRoom watch1 closed because of error <Error: errCode: -402012 realtime listener init ws fail | errMsg: errors of each retry (latest to oldest): ["[object Object]","TypeError: Cannot add property Map, object is not extensible","TypeError: Cannot add property Map, object is not extensible","TypeError: Cannot add property Map, object is not extensible","TypeError: Cannot add property Map, object is not extensible","TypeError: Cannot add property Map, object is not extensible"] history states: UNINIT-(close)->CLOSED>
一模一样的问题,期待答案
我发现推送老版本基础库到手机端问题就消失了,肯定是基础库什么地方不兼容实时推送的语句了