Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: TypeError: Do not know how to serialize a BigInt
调用订阅消息后测试消息可以发送成功,但是返回值报错Do not know how to serialize a BigInt,无法判断是否发送成功。
2022-05-01 解决方法:云函数的返回值不要返回result,直接返回result.errCode,就不会报错。原因是直接返回result被序列化导致报错(其实就是bug),所以返回result.errCode足以用于判断!
这个错误是怎么回事呢?是官方的BUG吗?
这个问题我也遇到了,消息发出去了,但是报错
cloud function service error code -504002, error message TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at callback (:55914/var/runtime/node12/CallbackContext.js:31)
at :55914/var/runtime/node12/CallbackContext.js:81
at :55914/var/runtime/node12/Runtime.engine.js:237
at processTicksAndRejections (:55914/appservice/internal/process/task_queues.js:97); at cloud.callFunction api;
at new u (VM857 WAService.js:2)
at d (VM857 WAService.js:2)
at f (VM857 WAService.js:2)
at Function.success (VM857 WAService.js:2)
at VM857 WAService.js:2
at x (VM857 WAService.js:2)
at i.<anonymous> (VM857 WAService.js:2)
at i.emit (VM857 WAService.js:2)
at Ea (VM857 WAService.js:2)
这个问题我昨天也遇到了,虽然消息发送成功了。但是云函数就退出了。所以效果就是我在云函数中准备给一批用户发送订阅消息,结果就是发送了第一个用户后,其它用户就收不到了。这个问题还是必须解决掉。我也还没有找到原因。不知道怎么回事?
"errCode": -504002,
"errMsg": "callFunction:fail -504002 functions execute fail. requestID t_1647352800638_12041-17f8de0ebd5_2, TypeError: Do not know how to serialize a BigInt\n at JSON.stringify (<anonymous>)\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)"
}