[Bug]: TypeError: Do not know how to serialize a BigInt
See original GitHub issueWhat happened?
I have installed the basic starter kit and I am getting an error:
The only thing I installed after is the dotenv
package.
When I remove all methods with the @Slash decorator the bot starts without problem.
Reproduction
https://github.com/G33RY/starter-app
Package
discordx
Version
Stable
Relevant log output
bot >> connecting discord...
Malloybot >> commands >> global
>> adding 0 []
>> updating 0 []
>> deleting 0 []
>> skipping 0 []
TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at Client.isApplicationCommandEqual (file:///Users/G33RY/Projects/Work/starter-app/node_modules/discordx/src/Client.ts:797:14)
at file:///Users/G33RY/Projects/Work/starter-app/node_modules/discordx/src/Client.ts:619:17
at Array.map (<anonymous>)
at Client.initGuildApplicationCommands (file:///Users/G33RY/Projects/Work/starter-app/node_modules/discordx/src/Client.ts:602:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Client.initApplicationCommands (file:///Users/G33RY/Projects/Work/starter-app/node_modules/discordx/src/Client.ts:555:5)
at async Client.<anonymous> (file:///Users/G33RY/Projects/Work/starter-app/src/main.ts:39:3)
[nodemon] app crashed - waiting for file changes before starting...
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
JSON.stringify() doesn't know how to serialize a BigInt #30
With typescript I get the error: TS2339: Property 'toJSON' does not exist on type 'BigInt'.
Read more >"TypeError: Do not know how to serialize a BigInt" - General
Hi NR folks! I'm facing a strange sporadic error from the file in node. Sometimes this happens a few times a day and...
Read more >JSON stringify and PostgreSQL bigint compliance
Solution that I ended up with... Inject full 123n numbers, and then un-quote those with the help of RegEx: function toJson(data) { return ......
Read more >bigint - # - json - DEV Community
If you try to just JSON.stringify(data) you will get the error TypeError: Do not know how to serialize a BigInt .
Read more >Prisma, Express, CockroachDB - Serialize BigInt Error ... - Reddit
When im attempting to make a Post request i get this error: TypeError: Do not know how to serialize a BigInt.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
please read this to understand issue in depth https://dev.to/benlesh/bigint-and-json-stringify-json-parse-2m8p
and use this solution for now, https://github.com/oceanroleplay/discord.ts/blob/main/packages/discordx/examples/permission/main.ts#L9
Its working for me too. Thank you.