#serialize a bigint Plugins

1 messages · Page 1 of 1 (latest)

gaunt viper
#
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)```
pine pathBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

runic oriole
#

@celest coral is this fixed with the rewrites?

celest coral
#

Otherwise I can “fix it” by serialising bigint to string but… that has a heavy performance impact

gaunt viper
#

how can I fix this

#

i just put a Date.now() as BigInt in prisma

#

and return that in res.json

runic oriole
#

If it's a date, maybe serialize it to a string beforehand? Unix timestamp as a string that is.