这个问题后来有解吗? 我也遇到这种问题,关键还是偶现的,好难查
wx.cloud.callFunction 调用云函数无反应(控制台无报错,函数日志为空)?wx.cloud.callFunction ,开发工具、版本都是最新。尝试过重启、更换函数名都无效 这是整体函数: [代码]doUpload: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]Dialog.confirm({[代码][代码] [代码][代码]title:[代码][代码]"上传一张您的全身照以开始体验!如:"[代码][代码],[代码][代码] [代码][代码]confirmButtonText:[代码][代码]"上传"[代码][代码] [代码][代码]}).then( ()=>{ [代码][代码]//注意这里要写回调函数[代码] [代码] [代码][代码]// 选择图片[代码][代码] [代码][代码]wx.chooseImage({[代码][代码] [代码][代码]count: 1,[代码][代码] [代码][代码]sizeType: [[代码][代码]'compressed'[代码][代码]],[代码][代码] [代码][代码]sourceType: [[代码][代码]'album'[代码][代码], [代码][代码]'camera'[代码][代码]],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码] [代码] [代码][代码]wx.showLoading({[代码][代码] [代码][代码]title: [代码][代码]'上传中'[代码][代码],[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]const filePath = res.tempFilePaths[0][代码][代码] [代码][代码]let that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]// 上传图片[代码][代码] [代码][代码]const cloudPath = `${Math.floor(Math.random() * 999999)}.png`;[代码][代码] [代码][代码]wx.cloud.uploadFile({[代码][代码] [代码][代码]cloudPath,[代码][代码] [代码][代码]filePath,[代码][代码] [代码][代码]success: res => {[代码][代码] [代码][代码]console.log([代码][代码]'[上传文件] 成功:'[代码][代码], res)[代码] [代码] [代码][代码]app.globalData.fileID = res.fileID[代码][代码] [代码][代码]app.globalData.cloudPath = cloudPath[代码][代码] [代码][代码]app.globalData.imagePath = filePath[代码][代码] [代码][代码]console.log(123)[代码] [代码] [代码] [代码] [代码] [代码]////////就是这里的[代码] [代码][代码]wx.cloud.callFunction,在控制台可以发现上面的代码都执行了,但是.callFunction貌似未执行?控制台无任何相关输出,函数日志也是空[代码][代码] [代码][代码] [代码][代码] [代码][代码] [代码][代码] [代码] [代码][代码]wx.cloud.callFunction({[代码][代码] [代码][代码]name:[代码][代码]"UPI"[代码][代码],[代码][代码] [代码][代码]config:{[代码][代码] [代码][代码]env:[代码][代码]"dhu-x1s0f"[代码][代码] [代码][代码]},[代码][代码] [代码][代码]data:{[代码][代码] [代码][代码]fileID:res.fileID,[代码][代码] [代码][代码]token:that.pageData.baiduToken[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}).then(res=>{[代码][代码] [代码][代码]wx.navigateTo({[代码][代码] [代码][代码]url: `../show/show?img=${res.result.finalImg}`[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码] [代码] [代码][代码]).[代码][代码]catch[代码][代码](err=>{[代码][代码] [代码][代码]console.log(err);[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]fail: e => {[代码][代码] [代码][代码]console.error([代码][代码]'[上传文件] 失败:'[代码][代码], e)[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]icon: [代码][代码]'none'[代码][代码],[代码][代码] [代码][代码]title: [代码][代码]'上传失败'[代码][代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]complete: () => {[代码][代码] [代码][代码]wx.hideLoading()[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]fail: e => {[代码][代码] [代码][代码]console.error(e)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码])[代码] [代码] [代码] [代码] [代码][代码]}[代码]云函数: [图片] 日志: [图片] 控制台: [图片]
2022-03-05