收藏
回答

云函数本地调试换成最简单的查询还是一直出错,CloudSDKError?

const cloud = require('wx-server-sdk')

cloud.init();



// 云函数入口函数

exports.main = async (event, context) => {

const wxContext = cloud.getWXContext();

//console.log(cloud);

const db = cloud.database()

const recruit= await db.collection('recruit_school').limit(10).get();

console.log(recruit);

return {

event

}

}


appId:wx2e35d90edf748699

云环境:gkzy-k8bhr

回答关注问题邀请回答
收藏

1 个回答

  • 是小白啊
    是小白啊
    2020-05-13

    具体报错信息是什么?

    2020-05-13
    有用
    回复 2
    • 🐷
      🐷
      2020-05-13
      重新测试提示变成了collection不存在了:
      node.js:1 [error] 函数执行失败(耗时 120ms) Error: 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.; 
          at Object.returnAsCloudSDKError (F:\WeChatProjects\gkzy\cloudfunctions\query\node_modules\wx-server-sdk\index.js:6027:16)
          at Object.checkError (F:\WeChatProjects\gkzy\cloudfunctions\query\node_modules\wx-server-sdk\index.js:1359:23)
          at F:\WeChatProjects\gkzy\cloudfunctions\query\node_modules\wx-server-sdk\index.js:1425:33
          at processTicksAndRejections (internal/process/task_queues.js:85:5)
      2020-05-13
      回复
    • 🐷
      🐷
      2020-05-13
      我的云开发控制台中的数据库是有此集合的
      2020-05-13
      回复
登录 后发表内容
问题标签