2024-09-03 11:22:15 - FATAL - TypeError: Do not know how to serialize a BigInt
2024-09-03 11:22:15 - FATAL - at JSON.stringify (<anonymous>)
2024-09-03 11:22:15 - FATAL - at _ApiResponse.json (/home/x/SwBot/node_modules/@sapphire/plugin-api/dist/cjs/lib/structures/api/ApiResponse.cjs:101:75)
2024-09-03 11:22:15 - FATAL - at [HTTP-GET] (/home/x/SwBot/dist/routes/answers.js:20:25)
2024-09-03 11:22:15 - FATAL - at async _PluginListener.run (/home/x/SwBot/node_modules/@sapphire/plugin-api/dist/cjs/listeners/PluginServerMiddlewareSuccess.cjs:14:7)
2024-09-03 11:22:15 - FATAL - at async Object.fromAsync (/home/x/SwBot/node_modules/@sapphire/result/dist/cjs/index.cjs:619:22)
2024-09-03 11:22:15 - FATAL - at async _PluginListener._run (/home/xn/SwBot/node_modules/@sapphire/framework/dist/cjs/lib/structures/Listener.cjs:27:22)```
#serialize a bigint Plugins
1 messages · Page 1 of 1 (latest)
@celest coral is this fixed with the rewrites?
It’s a separate path, can be solved by making the object they’re serialising have a toJSON method
Otherwise I can “fix it” by serialising bigint to string but… that has a heavy performance impact
how can I fix this
i just put a Date.now() as BigInt in prisma
and return that in res.json
If it's a date, maybe serialize it to a string beforehand? Unix timestamp as a string that is.