这是由于你的app.js的环境变量没有配置 [图片]
关于云函数调用失败问题[图片] 云函数是这么写的: // 云函数入口文件 const cloud = require('wx-server-sdk') const db = cloud.database(); const _ = db.command; cloud.init() /** * 此函数用于向云数据库插入用户每周记录的体重情况 * 输入:插入时间、体重、身高 * 唯一标识:用户的openid */ // 云函数入口函数 exports.main = async (event, context) => { const wxContext = cloud.getWXContext(); const time = event.time; const openid = wxContext.OPENID; const weight = event.weight; const height = event.height; const res = await db.collection("weight_record").add({ data: { _openid: openid, time: time, weight: weight, height: height } }); console.log(openid); console.log(height); console.log(weight); return { event, openid: wxContext.OPENID, appid: wxContext.APPID, unionid: wxContext.UNIONID, } } //调用云函数 [图片] 也在app初始化时配置好了云环境id,以前没什么问题,版本一更新就不行了,求解答,谢谢
2021-06-08