Error DiscordAPIError[50001]: Missing Access

Code:
async updateInvites(guild: Guild) {
const vanity = await guild.fetchVanityData()
if(vanity?.code) {
this.invites.set(vanity.code, vanity.uses)
}

(await guild.invites.fetch()).map((invite) => {
this.invites.set(invite.code, invite.uses)
})
}
async updateInvites(guild: Guild) {
const vanity = await guild.fetchVanityData()
if(vanity?.code) {
this.invites.set(vanity.code, vanity.uses)
}

(await guild.invites.fetch()).map((invite) => {
this.invites.set(invite.code, invite.uses)
})
}
Error: DiscordAPIError[50001]: Missing Access at handleErrors (/root/Projects/Fate/Main/node_modules/@discordjs/rest/dist/index.js:722:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (/root/Projects/Fate/Main/node_modules/@discordjs/rest/dist/index.js:1120:23) at async SequentialHandler.queueRequest (/root/Projects/Fate/Main/node_modules/@discordjs/rest/dist/index.js:953:14) at async _REST.request (/root/Projects/Fate/Main/node_modules/@discordjs/rest/dist/index.js:1266:22) at async Guild.fetchVanityData (/root/Projects/Fate/Main/node_modules/discord.js/src/structures/Guild.js:657:18) at async InviteManager.updateInvites (/root/Projects/Fate/Main/dist/struct/managers/InviteManaget.js:64:24) at async /root/Projects/Fate/Main/dist/app/Economy/Events/Ready.js:15:5
9 Replies
d.js toolkit
d.js toolkit10mo 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 staff
Its
ItsOP10mo ago
I can’t figure out what the error is.
chewie
chewie10mo ago
your bot seems to be missing the required permissions to fetch the invites
Its
ItsOP10mo ago
The bot has all the rights as well as intents If it were so easy, I wouldn’t write this appeal here :15cutemdaa: Not relevant, I fixed this bug
chewie
chewie10mo ago
and what was the issue?
Its
ItsOP10mo ago
it was that there were 13 boosts on the server and not 14 and the bot did not find the link, I just added a check for this and now everything is fine, the code does not crash
chewie
chewie10mo ago
Weird, it shouldn't even throw that error with no code set according to discord documentation
Its
ItsOP10mo ago
I didn’t understand it myself at first to be honest :smeshno:
chewie
chewie10mo ago
According to discord's documentation, it should just return null instead of the code, not missing access but well, when was discord ever consistent
Want results from more Discord servers?
Add your server