云函数本地调用成功,云端调用失败?
函数名login index.js:// cloud function - login const cloud = require("wx-server-sdk"); cloud.init({ env: 'test-9gnvx26ea1ae24cd', // env: "release-824dd3", traceUser: true }); /** * 将经自动鉴权过的小程序用户 openid 返回给小程序端, * 若取得的数据多于一条, 则以 data[0] 为准 */ exports.main = async(event, context) => { // console.log(event, context); // 获取 WXContext (微信调用上下文), 包括 OPENID, APPID, UNIONID(需满足获取条件) const wxContext = cloud.getWXContext(); return await cloud.database().collection("adminInfo").where({ openid: wxContext.OPENID }).get().then(r => { console.log("[result]", r); const isAdmin = r.data.length && r.data[0].isAdmin; if (isAdmin) { return { openid: wxContext.OPENID, unionid: wxContext.UNIONID, isAdmin: true, name: r.data[0].name, isSuper: r.data[0].isSuper }; } else { return { openid: wxContext.OPENID, unionid: wxContext.UNIONID, isAdmin: false }; } }).catch(err => { return { err: true, errMsg: err } }); } 报错【login】call failed Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID , cloud function service error code -501000, error message Environment not found; at cloud.callFunction api; [图片]本地调试成功截图如上 关闭本地调试截图[图片] package.json文件 { "name": "login", "version": "1.0.1", "description": "Login and check users' auth.", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Dorence Deng", "license": "MIT", "dependencies": { "wx-server-sdk": "latest" } }