云函数报错
使用云函数调用msgSecCheck方法时会报错 代码如下: [代码]// 云函数入口文件[代码][代码]const cloud = require([代码][代码]'wx-server-sdk'[代码][代码])[代码][代码]const got = require([代码][代码]'got'[代码][代码])[代码] [代码]let appid = [代码][代码]''[代码][代码];[代码][代码]let secret = [代码][代码]''[代码][代码];[代码] [代码]let msgCheckUrl = [代码][代码]'https://api.weixin.qq.com/wxa/msg_sec_check?access_token='[代码][代码];[代码][代码]let tokenUrl = [代码][代码]'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='[代码][代码]+appid+[代码][代码]'&secret='[代码][代码]+secret[代码] [代码]cloud.init()[代码] [代码]// 云函数入口函数[代码][代码]exports.main = async (event, context) => {[代码][代码] [代码][代码]let tokenResponse = await got(tokenUrl)[代码][代码] [代码][代码]let token = JSON.parse(tokenResponse.body).access_token;[代码] [代码] [代码][代码]// 文本内容检测接口拼接 access_token 值, JSON.stringIfy 将值转换成 JSON 字符串[代码][代码] [代码][代码]let checkResponse = await got(msgCheckUrl + token, {[代码][代码] [代码][代码]body: JSON.stringify({[代码][代码] [代码][代码]content: event.text[代码][代码] [代码][代码]})[代码][代码] [代码][代码]});[代码][代码] [代码][代码]return[代码] [代码]checkResponse.body[代码] 报错如下: Uncaught (in promise) Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail cloud function service error code -504002, error message incorrect header check; at cloud.callFunction api; at new t (WAService.js:22) at o (WAService.js:22) at Object.i [as returnAsFinalCloudSDKError] (WAService.js:22) at Function.success (WAService.js:21) at Object.success (WAService.js:4) at L.<anonymous> (WAService.js:7) at L.emit (WAService.js:8) at Function.<anonymous> (WAService.js:12) at WAService.js:6 at e (appservice?t=1561966315142:1107) 求解