#Error: Expected token to be set for this request, but none was present
16 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - 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!
import { REST } from "@discordjs/rest";
const discordRest = new REST({ version: "10" }).setToken(
process.env.DISCORD_TOKEN
);
export default discordRest;
Console log process.env.DISCORD_TOKEN and see what it shows
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
Of course
Did you try to use .env values in client side code? Hopefully you don’t send your bot token to the client so that won‘t work
nope, this is server-side rendering
And yet you get the error in the browser and not your console?
If that happened for code that only ran on the server side that would be a security issue in itself
This is using Next.js dev command. There is a different one for production
try rest.setToken('MTA...') before doing requests
idk i dont want to do that, in my code
