云函数 await 调用?
发布于 6 年前 作者 ohao 3695 次浏览 来自 问答

return  await cloud.uploadFile({

      cloudPath: dataCVS,

      fileContent: buffer, //excel二进制文件

    }).then(res=>{

      let filelist=[]

      filelist.push(res.fileID)

    //  return filelist

     await cloud.getTempFileURL({

          fileList: filelist,

        }).then(rec=>{

          return rec

        })

      })

不知怎么处理

Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 93f28b09-6067-11ea-8374-525400697544, cloud function service error code -504002, error message Unexpected identifier; at cloud.callFunction api;

    at new u (VM227 WAService.js:2)

    at d (VM227 WAService.js:2)

    at f (VM227 WAService.js:2)

    at Function.success (VM227 WAService.js:2)

    at VM227 WAService.js:2

    at x (VM227 WAService.js:2)

    at i.<anonymous> (VM227 WAService.js:2)

    at i.emit (VM227 WAService.js:2)

    at Ea (VM227 WAService.js:2)

    at VM227 WAService.js:2

2 回复

我这种方法哪里错了?

let res = await cloud.uploadFile({
    cloudPath: dataCVS,
    fileContent: buffer
})
let filelist = []
filelist.push(res.fileID)
return await cloud.getTempFileURL({
    fileList: filelist,
})
回到顶部