请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

请问完成去重代码后,云端测试云函数执行失败

报错{“errorCode”:1,“errorMessage”:“user code exception caught”,“stackTrace”:“errCode: -502005 database collection not exists | errMsg: [ResourceNotFound] Db or Table not exist. Please check your request, but if the problem cannot be solved, contact us.; \nError: errCode: -502005 database collection not exists | errMsg: [ResourceNotFound] Db or Table not exist. Please check your request, but if the problem cannot be solved, contact us.; \n at Object.returnAsCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6187:16)\n at Object.checkError (/var/user/node_modules/wx-server-sdk/index.js:1364:23)\n at Promise (/var/user/node_modules/wx-server-sdk/index.js:1499:33)\n at \u003canonymous\u003e\n at process._tickCallback (internal/process/next_tick.js:188:7)”}

正在回答

1回答

https://img1.sycdn.imooc.com//szimg/5f2580f7094cbc0115340678.jpg

错误信息是集合不存在:

1、需要手动在云数据库中创建相应集合

2、在云函数中初始化云环境:

cloud.init({
     env: cloud.DYNAMIC_CURRENT_ENV

})

0 回复 有任何疑惑可以回复我~
  • 提问者 yZw丶先生 #1
    非常感谢!是没有在云函数中初始化云环境导致的
    回复 有任何疑惑可以回复我~ 2020-08-01 23:14:42
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信