Expected token to be set for this request, but none was present
I started to use discordjs/rest for some of my stuff to have less api calls in my overall code. One of those being the following
It should in theory work just fine but for some reason its complaining about a token not being set. I tried to use client.rest.setToken but that doesnt seem to work either. Is there something im missing?
12 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!Joining in.
We are using discordjs/rest v2.2.0 and discord.js v14.14.1
Well it add a thread to a message I would need to get the channel -> the message -> then add a thread
I havent found a function yet where it just takes in a message id and then adds a thread
I dont think that is the case for us as there is nothign else logged besides that token thing that could error
Oh thanks I will look into that. Still weird it doesnt work with the rest way tho
Like this where WouldYou is the class We extend the client from and call using this
import WouldYou from "./wouldYou";
Oh no wait its being passed in the constructor
We pass in the this keyword which should be the client we extend
the same one we use to login
Yea sure one second
https://github.com/Would-You-Bot/client/blob/main/src/util/wouldYou.ts#L115 would be this line
GitHub
client/src/util/wouldYou.ts at main · Would-You-Bot/client
Elevate your server's engagement with Would You, featuring user voting, daily messages, and customizability. Would You Rather - Would-You-Bot/client
I think the sharder we use sets the DISCORD_TOKEN env variable hence why login works. The one we pass into the env is TOKEN so that cant be it
yes
We had that removed before but then that token issue came up so we added it above the thread line
This is so confusing tbh doesnt make any sense to why it would complain about the token
This is the one I have from sentry which is a bit outdated cause it shows the old code there
Ill get that done tomorrow dont got much time today
thanks for the help!
I found the issue