收藏
回答

openapi.security.imgSecCheck返回41005错误?

从小程序云函数调用imgSecCheck()时一直报41005错误,但是对应的media已经按文档设置。

errCode: 41005  | errMsg: openapi.security.imgSecCheck:fail media data missing hint: [xKvxiA04673955]

错误信息提示

imgSecCheck() is triggered from cloud with event:  
{action: "imgSecCheck", contentType: "image/jpg", buffer: {…}}
action"imgSecCheck"
buffer: {type"Buffer"data: Array(15006)}
contentType"image/jpg"
__proto__: Object
exception during imgSecCheck, eError: errCode: 41005  | errMsg: openapi.security.imgSecCheck:fail media data missing hint: [xKvxiA04673955]
    at callWXOpenAPI (/.../cloudfunctions/openapi/node_modules/wx-server-sdk/index.js:2267:31)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async imgSecCheck (/.../cloudfunctions/openapi/index.js:43:15)

小程序云开发服务端代码段

// 图片内容检测
async function imgSecCheck(event) {
  console.debug('imgSecCheck() is triggered from cloud with event: ', event)
  try {
    let res = await cloud.openapi.security.imgSecCheck({
      media: {
        contentType: event.contentType, // 'image/png',
        value: event.value, // Buffer
      }
    })
  
    return res
  }
  catch (e) {
    console.error('exception during imgSecCheck, e: ', e)
    return e
  }
}
回答关注问题邀请回答
收藏

2 个回答

  • Mr.Zhao
    Mr.Zhao
    2020-02-26

    2020-02-26
    有用 1
    回复 1
    • moakap
      moakap
      2020-02-26
      已解决,是value参数的类型问题。谢谢!
      2020-02-26
      回复
  • 17Read
    17Read
    2020-05-16

    你可以试试这篇文章解决方式:完美解决

    https://mp.weixin.qq.com/s/o77bLIfCEkHq3acmqS4Tyw

    2020-05-16
    有用
    回复 1
    • 2014
      2014
      2021-06-15
      还要花钱?
      2021-06-15
      回复
登录 后发表内容
问题标签