question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: TypeError: Do not know how to serialize a BigInt

See original GitHub issue

What 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:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
G33RYcommented, Jul 30, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found