小程序ocr通过二进制上传识别出错openapi.ocr.vehicleLicense:fail media data missing
// item 为 chooseImage 返回的图片 path let buffer = wx.getFileSystemManager().readFileSync(item) wx.cloud.callFunction({ name:'printedTextOCR', data: { buffer } }).then( r => { console.log(r) } ) // 云函数 const cloud = require('wx-server-sdk') cloud.init() exports.main = async (event, context) => { return await cloud.openapi.ocr.printedText({ type:'photo', img: { contentType:'image/jpg', value: event.buffer } }).then(r => r).catch(e => e) }
报如下错误:
errCode: 41005,
errMsg:"openapi.ocr.printedText:fail media data missing hint: [Jo03914741]"
更新:云函数图片的二进制数据如下:
value: Buffer.from(event.buffer)
转 : https://developers.weixin.qq.com/community/develop/doc/000e0a8ba305f067ac397176b56800