401 error on get request
I'm trying to get a list of all of my guild application commands for this bot but I'm getting a 401 error on this rest request and i haven't the slightest idea why.
Code:
Error:
I'm loading the environment variables using dotenv (which I've confirmed loads them).
I've tried regenerating the token and giving my bot application-commands scope in OAuth but neither worked.
I'm using node v21.5.0 and djs v14.14.1.
Probably an easy answer, but i appreciate any guidance you can give, I'm quite new to this bot stuff :D
4 Replies
- 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 OPheres the full code, i just left out the dotenv because i didnt think it was relevant to the issue
I confirmed it by console logging my whole process.env object before the try catch block and all of the variables in my env file appear in the output
ive reset the token twice and it still hasn't worked. I've also made sure the bot is in the guild that im quering. I've even tried it with global commands and it still 401s
yep, they are from the same application in the dev portal
heres the 4 entires i add to the env outputed with this.
also ignore my horrid touchpad paint job :Hehe:
they've been the same because ive had this bot running in the past, and i've even put commands on the bot before. For whatever reason it just works now though so idk, maybe i did do something wrong