- 当前 Bug 的表现(可附上截图)
云开发中调用 customerServiceMessage.uploadTempMedia 接口上传图片媒体 到 微信服务器上,一直报错:
errCode: -501007,
errMsg: 'customerServiceMessage.uploadTempMedia:fail Invalid request param
我是先将要上传的图片 存储到云开发的文件存储中,然后再云函数中通过FileID下载文件获得图片buffer,然后调用
uploadTempMedia函数上传到微信服务器。
这是云函数代码:
const cloud = require('wx-server-sdk')
const fileID = 'cloud://****.jpg'
cloud.init()
// 云函数入口函数
exports.main = async (event, context) => {
var resfile = await cloud.downloadFile({
fileID,
})
var buffer = resfile.fileContent
return cloud.openapi.customerServiceMessage.uploadTempMedia({
type: 'image',
media: {
contentType: 'image/jpeg',
value: buffer
}
}).then((res) => {
console.log('success', res);
}).catch((error) => {
console.log('error', error)
})
}
- 预期表现
云开发中调用 customerServiceMessage.uploadTempMedia 上传图片媒体 到 微信服务器 正常
您好,能否提供报错时返回的信息?
这是云函数的报错信息:
2019-05-11T09:02:01.138Z error { Error: errCode: -501007 invalid parameters | errMsg: customerServiceMessage.uploadTempMedia:fail Invalid request param
at new CloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6166:28)
at Object.<anonymous> (/var/user/node_modules/wx-server-sdk/index.js:421:35)
at step (/var/user/node_modules/tslib/tslib.js:133:27)
at Object.next (/var/user/node_modules/tslib/tslib.js:114:57)
at fulfilled (/var/user/node_modules/tslib/tslib.js:104:62)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
errCode: -501007,
errMsg: 'customerServiceMessage.uploadTempMedia:fail Invalid request param' }
这么严重没人管?
亲,你这个问题解决了吗?