#Error: Expected token to be set for this request, but none was present

16 messages · Page 1 of 1 (latest)

dreamy flicker
#
useEffect(() => {
    discordRest.get(Routes.user(voter.userId)).then((data) => {
      console.log(data);
      setUser(data);
    });
  }, [voter.userId]);```
honest crowBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
dreamy flicker
#
import { REST } from "@discordjs/rest";
const discordRest = new REST({ version: "10" }).setToken(
  process.env.DISCORD_TOKEN
);
export default discordRest;
brave kraken
dreamy flicker
#

Hmm. Doesn't work in the exact functional component I'm writing this in, but works in the main component

#

I'm gonna look into this, ty

brave kraken
#

Of course

desert wraith
dreamy flicker
desert wraith
#

If that happened for code that only ran on the server side that would be a security issue in itself

dreamy flicker
nocturne parcel
dreamy flicker
#

idk i dont want to do that, in my code

desert wraith
#

If you don’t then how do you expect the rest call to work?Thonk

#

Do you have another setToken call in your code somewhere?