收藏
回答

如何解决云调用msgSecChecked报错user code exception caught?

问题描述:

使用云调用msgSecChecked时,传正常值,如“哈哈哈” 返回正常:{"errMsg":"openapi.security.msgSecCheck:ok","errCode":0}

传示例不合规值,如“特3456书yuuo莞6543李zxcz蒜7782法fgnv级” 报如下错误

问题:是否不合规情况就是如https://developers.weixin.qq.com/community/develop/article/doc/000408d38d8090d079f84ad0d56013这篇文章所说走catch,而不是正常的返回值?

报错信息:

云函数

const cloud = require('wx-server-sdk')

cloud.init()

exports.main = async (event, context) => {

return await cloud.openapi.security.msgSecCheck({

content:event.txt

})

}

云控制台报错日志:

日志内容 Request ID: 707160e6-6948-11eb-a9da-525400c2bfee

执行时间: 234ms内存使用: 29.43 MB

返回结果

{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"Error: errCode: 87014 | errMsg: openapi.security.msgSecCheck:fail risky content rid: 601feb1e-3467af87-0ef4098c\n at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2390:31)\n at process._tickCallback (internal/process/next_tick.js:68:7)","statusCode":430}

日志

START RequestId:707160e6-6948-11eb-a9da-525400c2bfee

2021-02-07T13:29:02.363Z 当前未指定env,将默认使用第一个创建的环境!

ERROR RequestId:707160e6-6948-11eb-a9da-525400c2bfee Result:{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"Error: errCode: 87014 | errMsg: openapi.security.msgSecCheck:fail risky content rid: 601feb1e-3467af87-0ef4098c\n at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2390:31)\n at process._tickCallback (internal/process/next_tick.js:68:7)","statusCode":430}

END RequestId:707160e6-6948-11eb-a9da-525400c2bfee

Report RequestId:707160e6-6948-11eb-a9da-525400c2bfee Duration:234ms Memory:256MB MemUsage:29.429688MB

开发工具报错日志:

VM804 WAService.js:2 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID local_debug_3afc99b4-0668-4df7-b355-fb05b207919b, cloud function service error code -1, error message errCode: 87014  | errMsg: openapi.security.msgSecCheck:fail risky content rid: 6020921d-2eb0240f-0bb98dfa; at cloud.callFunction api; 

    at new g (VM804 WAService.js:2)

    at c (VM804 WAService.js:2)

    at I (VM804 WAService.js:2)

    at Function.success (VM804 WAService.js:2)

    at C (VM804 WAService.js:2)

    at VM804 WAService.js:2

    at u (VM804 WAService.js:2)

    at Function.<anonymous> (VM804 WAService.js:2)

    at C (VM804 WAService.js:2)

    at VM804 WAService.js:2

errorReport @ VM804 WAService.js:2

thirdErrorReport @ VM804 WAService.js:2

(anonymous) @ VM804 WAService.js:2

I @ VM804 WAService.js:2

o @ VM804 WAService.js:2

(anonymous) @ VM804 WAService.js:2

value @ VM804 WAService.js:2

o @ VM804 WAService.js:2

(anonymous) @ VM804 WAService.js:2





回答关注问题邀请回答
收藏

1 个回答

  • TNT
    TNT
    2021-02-18

    2021-02-18
    有用
    回复
登录 后发表内容
问题标签