收藏
回答

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)
      }
    })
    }
    )
 
    
  }

云函数:


日志:


控制台:


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

1 个回答

登录 后发表内容
问题标签