现象:本地环境调试,可以获取图片资源的buffer。上传到正式环境,获取不到数据,且无异常信息。云函数设置超时时间都是20s;
相关代码:
const getImgMediaId = async function (imgPath) {
const fileID = `${cloudFilePrefix}${imgPath}`
let finalRes = {}
let downFileRes = {}
console.log("fileID", fileID)
try {
downFileRes = await cloud.downloadFile({
fileID: fileID
})
console.log("downFileRes", downFileRes)
} catch (e) {
console.log(111, e)
}
try {
finalRes = await cloud.openapi.customerServiceMessage.uploadTempMedia({
type: 'image',
media: {
contentType: 'image/jpeg',
value: file
}
})
} catch (e) {
console.log(222, e)
}
return finalRes
}
云函数日志:
返回结果
null
日志
START RequestId: f9903ccb-78b0-11ea-993b-525400090c2c
Event RequestId: f9903ccb-78b0-11ea-993b-525400090c2c
2020-04-07T09:20:09.668Z fileID cloud:
END RequestId: f9903ccb-78b0-11ea-993b-525400090c2c
Report RequestId: f9903ccb-78b0-11ea-993b-525400090c2c Duration:103ms Memory:256MB MemUsage:35.730469MB
null代表查不到吧,检查下path和id是否正确对应。