使用的数据如下:
data:{
'thing7':{'value':event.name},
'thing8':{'value':event.zj_staff},
'thing6':{'value':event.visit_reason},
'phrase2':{'value':event.audit},
'thing3':{'value':event.other},
},
#上面的值,都是字符串,没有数字,报错Do not know how to serialize a BigInt\n at JSON.stringify
用了两个不同模板,其中一个模板ID为,_LXTR-Y-XUDAO1bnz-h4DV5LkDvoNrFk3aqPSEPwai0。
报错相同信息如下:
"errorCode":1,"errorMessage":"user code exception caught","stackTrace":
"TypeError: Do not know how to serialize a BigInt\n at JSON.stringify
(\u003canonymous\u003e)\n at callback (/var/runtime/node12/CallbackContext.js:31:23)\n
at /var/runtime/node12/CallbackContext.js:81:16\n at /var/runtime/node12/Runtime.engine.js:237:13\n
at processTicksAndRejections (internal/process/task_queues.js:97:5)","statusCode":430}
是在开发者工具本地调试的时候出现吗?在线上会出现吗?
贴下云函数的代码?
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({env: cloud.DYNAMIC_CURRENT_ENV})
// 云函数入口函数
exports.main = async (event, context) => {
console.log('sendauditmes', event)
try{
const result = await cloud.openapi.subscribeMessage.send({
touser: event.openid,
templateId:event.templateId,
data:{
'thing7':{'value':event.name},
'thing8':{'value':event.zj_staff},
'thing6':{'value':event.visit_reason},
'phrase2':{'value':event.audit},
'thing3':{'value':event.other},
},
})
return result
}catch (err) {
console.log('err', err)
return err
}
}
我也遇到类似问题, 求解
{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"TypeError: Converting circular structure to JSON\n --\u003e starting at object with constructor 'ClientRequest'\n | property 'socket' -\u003e object with constructor 'TLSSocket'\n --- property '_httpMessage' closes the circle\n at JSON.stringify (\u003canonymous\u003e)\n at callback (/var/runtime/node12/CallbackContext.js:31:23)\n at /var/runtime/node12/CallbackContext.js:81:16\n at /var/runtime/node12/Runtime.engine.js:237:13\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","statusCode":430}
求解
大哥 我也遇到了 是新Bug嘛?百度了一天了,沒有找到解決方法
if(err.errCode==-404011){
msg='消息发送成功';
//todo
}
好吧,我之前也没遇到过,不知道是不是因为装了什么插件导致的
at JSON.stringify (<anonymous>)
-504002也得判断下。
Object.keys(result).forEach(function(key) {
console.log(key,result[key]);
})
console.log(typeof result.errCode);
console.log(typeof result.errMsg);
console.log(JSON.stringify(result.errCode));
console.log(JSON.stringify(result.errMsg));
return result.errCode