调用云函数Cannot read property 'url_info' of undefine ?
这是目录结构 [图片] 然后是云函数uploadImg这个调用报错,开启本地调试也没问题, const cloud = require('wx-server-sdk')
const fs = require('fs')
const path = require('path')
cloud.init()
exports.main = async (event, context) => {
console.log('-------------') //控制台这里都没有输出
console.log(path.join('C:/Users/gou/WeChatProjects/miniprogram-11','/sources/images/index/like.png'))
const fileStream = fs.createReadStream(path.join('C:/Users/gou/WeChatProjects/miniprogram-11',
'/sources/images/index/like.png'))
console.log('-------------')
return await cloud.uploadFile({
cloudPath: 'demo.jpg',
fileContent: fileStream,
})
}
就是在这里调用时报错,这是在目录test2下的js文件里调用的,是一个按钮绑定了这个函数 upload(){
wx.cloud.callFunction({
sucess:(res)=>{},
// 要调用的云函数名称
name: 'uploadImg',
})
},
[图片] 最后是开启本地调式,这里就可以成功调用,上传的图片也可以看见了,请求方式是选择的手动触发, [图片] 最后感谢,希望可以帮我看看, [图片]