Error when trying to upload global slash commands

I have no idea why I am getting this error. When I register slash commands locally everything works fine, but when I set runBot(global = true) I get the following error:
node .
v22.2.0
Configuration file not found. Using a basic database...
Found 20 command files.
Finished loading commands.
Found 8 event files.
Finished loading events.
Failed to log in: TypeError: global.FinalizationRegistry is not a constructor
at new WeakSessionCache (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\core\connect.js:23:31)
at buildConnector (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\core\connect.js:82:24)
at new Pool (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\pool.js:55:17)
at Agent.defaultFactory (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\agent.js:22:7)
at [dispatch] (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\agent.js:93:34)
at Intercept (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\interceptor\redirect-interceptor.js:11:16)
at [Intercepted Dispatch] (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\dispatcher-base.js:158:12)
at Agent.dispatch (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\dispatcher-base.js:179:40)
at Agent.request (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\api\api-request.js:171:10)
at C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\api\api-request.js:164:15
Database synced successfully.
Database initialized successfully.
node .
v22.2.0
Configuration file not found. Using a basic database...
Found 20 command files.
Finished loading commands.
Found 8 event files.
Finished loading events.
Failed to log in: TypeError: global.FinalizationRegistry is not a constructor
at new WeakSessionCache (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\core\connect.js:23:31)
at buildConnector (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\core\connect.js:82:24)
at new Pool (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\pool.js:55:17)
at Agent.defaultFactory (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\agent.js:22:7)
at [dispatch] (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\agent.js:93:34)
at Intercept (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\interceptor\redirect-interceptor.js:11:16)
at [Intercepted Dispatch] (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\dispatcher-base.js:158:12)
at Agent.dispatch (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\dispatcher\dispatcher-base.js:179:40)
at Agent.request (C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\api\api-request.js:171:10)
at C:\Users\tomja\AppData\Roaming\nvm\v22.2.0\node_modules\djsbotbuilder\node_modules\undici\lib\api\api-request.js:164:15
Database synced successfully.
Database initialized successfully.
4 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
SowerofSystems
SowerofSystemsOP8mo ago
Discord.js version 14.14.1, node version 20.2.0
Naomi
Naomi8mo ago
global = true is overwriting the global object. That's gonna break so many things. If you're trying to pass true as the argument, runBot(true).
SowerofSystems
SowerofSystemsOP8mo ago
Thank you. I didn't realize there was a global object that would conflict with it. I renamed the variable, and it works now.
Want results from more Discord servers?
Add your server