cloud.uploadFile()始终失败?
照搬照抄云开发文档里的示例,运行后始终失败,一直都是返回如下错误代码
[error] 函数执行失败(耗时 178ms) TypeErruploadFile:fail or: uploadFile:fail Cannot read property ‘url’ of undefined
??急人,请老师指点
// 云函数入口文件
const cloud = require('wx-server-sdk')
const {
createReport
} = require('docx-templates')
const fs = require('fs')
const path = require('path')
// const dayjs = require('dayjs')
cloud.init({
env: 'cloud.DYNAMIC_CURRENT_ENV'
})
// 云函数入口函数
exports.main = async (event, context) => {
const fileStream = fs.createReadStream(path.join(__dirname, 'verify_company.docx'))
return await cloud.uploadFile({
cloudPath: 'verify_company.docx',
fileContent: fileStream,
})
}