db get score catch error Error: errCode: -1 | errMsg: document.get:fail Error: cannot find document with _id oQWhZ5Pqd7dtWfZJBuRKzyxhwR2M-score, please make sure that the document exists and you have the corresponding access permission; at document.get api;
at new t (WAGame.js:21)
at o (WAGame.js:21)
at Object.i [as returnAsFinalCloudSDKError] (WAGame.js:21)
at e.<anonymous> (WAGame.js:20)
at r (WAGame.js:19)
at Object.next (WAGame.js:19)
at a (WAGame.js:19)
at <anonymous>
upload score failed Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 363313bf-bc9a-11e8-b563-52540064d067, cloud function service error code -504002, error message Cannot find module 'wx-server-sdk'; at cloud.callFunction api;
at new t (WAGame.js:21)
at o (WAGame.js:21)
at Object.i [as returnAsFinalCloudSDKError] (WAGame.js:21)
at Function.success (WAGame.js:21)
at Object.success (WAGame.js:4)
at a.<anonymous> (WAGame.js:6)
at a.emit (WAGame.js:7)
at Function.<anonymous> (WAGame.js:8)
at WAGame.js:5
at e (gamePage.html:1)
第一个问题,我已经按照 快速启动步骤 创建了 score集合,无法解决这个问题。
第二个问题,看提示是说 wx-server-sdk 没有安装,不知道怎么解决。
请问怎么fix?小程序开发新人。
这个可以解决第二个问题,但是同时带来了第三个问题。
upload score failed Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID b849a8a6-bc9c-11e8-9e32-525400e8849e, cloud function service error code -504002, error message wx is not defined; at cloud.callFunction api;
at new t (WAGame.js:21)
at o (WAGame.js:21)
at Object.i [as returnAsFinalCloudSDKError] (WAGame.js:21)
at Function.success (WAGame.js:21)
at Object.success (WAGame.js:4)
at a.<anonymous> (WAGame.js:6)
at a.emit (WAGame.js:7)
at Function.<anonymous> (WAGame.js:8)
at WAGame.js:5
at e (gamePage.html:1)
第三个问题通过注释这行代码,重新上传部署后解决。
第一个问题,uploadScore云函数中,userRecord 的判断有问题导致逻辑错误。
修改前的代码:
修改后的代码:
第一个问题实际上在修好第二、三个问题后就好了,因为这是设计上会catch的错误,而反复出现的原因是因为有第二、三个问题导致数据库插入不成功导致的。
第一个问题并不是判断逻辑的问题吧,按你加的逻辑修改后,把数据库的记录删掉,第一次提交分数仍然会报错,这是catch到的err
我现在用模拟器运行,但是无法切换云环境了。
?就是下面这个删掉,再运行还是会报错
嗯,这个我知道了。但是我现在有一个新的问题就是没办法切换云环境。
我知道。我现在有新问题,我创建了两个云环境,如何切换?