发送失败单个用户 Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: TypeError: Do not know how to serialize a BigInt at JSON.stringify (<anonymous>) at callback (:16404/var/runtime/node12/CallbackContext.js:31) at :16404/var/runtime/node12/CallbackContext.js:81 at :16404/var/runtime/node12/Runtime.engine.js:237 at processTicksAndRejections (:16404/appservice/internal/process/task_queues.js:97) (callId: 1654062493905-0.8351469123361661) (trace: 13:48:13 start->13:48:14 system error (Error: errCode: -504002 functions execute fail | errMsg: TypeError: Do not know how to serialize a BigInt at JSON.stringify (<anonymous>) at callback (:16404/var/runtime/node12/CallbackContext.js:31) at :16404/var/runtime/node12/CallbackContext.js:81 at :16404/var/runtime/node12/Runtime.engine.js:237 at processTicksAndRejections (:16404/appservice/internal/process/task_queues.js:97)), abort) at S (WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2) at WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2 at WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2 at n (WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2)
试试加上以下代码防止JSON序列化报错:
BigInt.prototype.toJSON = function () { return this.toString() };
return JSON.parse(JSON.stringify(result))
遇到相同的问题
我也遇到的同样的问题。但是,并不影响程序的正常运行。
我也是,不过可以发送成功,会进入catch
at JSON.stringify (<anonymous>)
at callback (:16404/var/runtime/node12/CallbackContext.js:31)
at :16404/var/runtime/node12/CallbackContext.js:81
at :16404/var/runtime/node12/Runtime.engine.js:237
at processTicksAndRejections (:16404/appservice/internal/process/task_queues.js:97) (callId: 1654062493905-0.8351469123361661) (trace: 13:48:13 start->13:48:14 system error (Error: errCode: -504002 functions execute fail | errMsg: TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at callback (:16404/var/runtime/node12/CallbackContext.js:31)
at :16404/var/runtime/node12/CallbackContext.js:81
at :16404/var/runtime/node12/Runtime.engine.js:237
at processTicksAndRejections (:16404/appservice/internal/process/task_queues.js:97)), abort)
at S (WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2)
at WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2
at WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2
at n (WASubContext.js?t=wechat&s=1654061017246&v=2.24.0:2)
楼主解决了吗?我也遇到了这个问题。
VM180 WAService.js:2 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 64945d0b-471d-42a6-ac99-0ca7a3ddba0b, cloud function service error code -504002, error message TypeError: Do not know how to serialize a BigInt at JSON.stringify (<anonymous>) at callback (:24682/var/runtime/node12/CallbackContext.js:31) at :24682/var/runtime/node12/CallbackContext.js:81 at :24682/var/runtime/node12/Runtime.engine.js:237 at processTicksAndRejections (:24682/appservice/internal/process/task_queues.js:97); at cloud.callFunction api; at new e (VM180 WAService.js:26) at s (VM180 WAService.js:26) at c (VM180 WAService.js:26) at Function.success (VM180 WAService.js:26) at I (VM180 WAService.js:2) at VM180 WAService.js:2 at u (VM180 WAService.js:35) at Function.<anonymous> (VM180 WAService.js:35) at I (VM180 WAService.js:2) at VM180 WAService.js:2(env: macOS,mp,1.05.2201240; lib: 2.14.1) errorReport @ VM180 WAService.js:2 thirdErrorReport @ VM180 WAService.js:2 (anonymous) @ VM180 WAService.js:2 u @ VM180 WAService.js:2 g @ VM180 WAService.js:2 (anonymous) @ VM180 WAService.js:2 value @ VM180 WAService.js:2 e @ VM180 WAService.js:2 (anonymous) @ VM180 WAService.js:2
https://blog.csdn.net/weixin_52426668/article/details/130122486
解决方案如上
return JSON.stringify(sendmsg.errorCode);
会成功但是返回null