Discord.js bot fails with quick.db


#1

UPD: What a beautiful thing - “rewind”! Went back to a day before - pshhh! bot works perfectly. Still don’t know what is the problem was

Hello! Today I ran my bot on discord.js and typed the command “settings prefix #” and got an error in the console:

(node:4737) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
at stringify ()
at Snekfetch.send (/rbd/pnpm-volume/a84f5d27-ecce-40d0-b446-28f4e8fd59fb/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:120:19)
at APIRequest.gen (/rbd/pnpm-volume/a84f5d27-ecce-40d0-b446-28f4e8fd59fb/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/APIRequest.js:46:15)
at resolve (/rbd/pnpm-volume/a84f5d27-ecce-40d0-b446-28f4e8fd59fb/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:52:20)
at new Promise ()
at SequentialRequestHandler.execute (/rbd/pnpm-volume/a84f5d27-ecce-40d0-b446-28f4e8fd59fb/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:51:12)
at SequentialRequestHandler.handle (/rbd/pnpm-volume/a84f5d27-ecce-40d0-b446-28f4e8fd59fb/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:94:10)
at SequentialRequestHandler.push (/rbd/pnpm-volume/a84f5d27-ecce-40d0-b446-28f4e8fd59fb/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:41:10)
at Promise (/rbd/pnpm-volume/a84f5d27-ecce-40d0-b446-28f4e8fd59fb/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RESTManager.js:26:15)
at new Promise ()
(node:4737) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:4737) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My bot running on the latest version of discord.js
idk why i got error. Went back to previous commit, but same.
Bot: https://glitch.com/edit/#!/wood-lead?path=commands/settings.js:1:0 (it’s not a full version of my bot, full on github)
GitHub: https://github.com/jarvis394/expo_bot


#2

JSON doesn’t accept circular objects - objects that reference themselves. It looks like there’s a JSON.stringify() throwing an error in the snekfetch module, so I’d look at what you’re passing into it.


#3

I don’t know what is the problem, because my settings works perfectly and all values correctly writes to sqlite database. I’ve tested and figured out that bot fails after writing values into db (success message doesn’t sends).
I’m really confused because 2 days ago everything with new lib (quick.db) works perfectly.


(Auto-delete: Yes /After/ Auto-delete: No, but bot crashing after #settings delete no)

UPD. Bot crashing with any command, but only #settings can send a first menu. And #ping ofc because its just simple message. I’ve tried commands without quick.db, but same
Yesterday thought that it caused by problems with Glitch, idk


#4

Is it still dying with the circular structure error? Here’s some more info on that: https://stackoverflow.com/questions/4816099/chrome-sendrequest-error-typeerror-converting-circular-structure-to-json


#5

I think I MAY know what your problem is. I had issues with getting my token variable from my .env variables, but console output would show the token as something else entirely; overwriting it did nothing. As it turns out, the .env variables weren’t changing when I was editing them live; only after letting the app shut down and boot back up were its contents reinitialized.

BUT if you wanna do it manually, go to the console of your app and type (this is mostly nonsense, but export is important) “export WHATEVERVARIABLE=whateverstringyouneedbutdontusespaces”. It should then update. Apperantly typing “printenv” or “printenv WHATEVERVARIABLE” lets you see your environment variables in the console, so that’s helpful. Of course, what I did is for environment variables, so the specifics may be different.


#6

This was likely happening because of your watch.json settings. By default editing .env variables causes a restart which would have applied your changes straight away. But if you’ve overwritten that with a watch.json file, then it’s up to your own settings what the behavior is.