Console Error DiscordAPIError: Missing Access

(node:1593) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access

at item.request.gen.end (/rbd/pnpm-volume/aaec3d2d-aebb-4535-97bc-3451acb56ac6/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)

at then (/rbd/pnpm-volume/aaec3d2d-aebb-4535-97bc-3451acb56ac6/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)

at process._tickCallback (internal/process/next_tick.js:68:7)

(node:1593) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 914)

Project name: salty-airport

What exactly was the bot trying to do when it got this error? The error is useless without context. Maybe the bot did not have the necessary permission to do something.

No bot turns out this error without doing anything command and so on. without

The problem is still in progress

Hey @MeliL this problem usually has to do with the level of access permissions you’ve given the bot, as @advaith noted. You might be able to resolve it by updating the bot’s configuration in the developer portal to give it all permissions.

Reading through the error, though, it looks like your bot is making a request that uses snekfetch, and the underlying snekfetch request fails with the permissions error. The larger error you’re seeing is because you’re not wrapping whatever call to snekfetch is failing in a try{}/catch{} block, so when the Promise for the snekfetch request throws an error it doesn’t have any error-handling code associated with it. If updating your bot’s permissions isn’t an option, you could look for where you’re using snekfetch and make sure that you have appropriate error handling code around each time you use it.

One other note, snekfetch has been deprecated and replaced with node-fetch. If you replace snekfetch in your code it’s possible that node-fetch already does a better job of handling this issue.

@cori discord.js stable relies (or used to, idk if stable has been updated to node-fetch) on snekfetch for Discord API requests.

1 Like

That’s good to know. Possibly they should also be responsible for proper error handling to fix the UnhandledPromiseRejectionWarning issues as well.

I changed snekfetch to node-fetch and I did node-fetch via command, but still the same problem

const fetch = require('node-fetch');

The issue is something you are doing with discord.js (not snekfetch or node-fetch). Also node-fetch has a different syntax than snekfetch so if you switch you will need to update your snekfetch code.

The same error has come and is still in progress

Have you tried setting the bot permissions to allow everything and seeing if that resolves the permissions issue? Even if you don’t want to leave your bot configured to assert all the permissions if you allow them all and turn off the ones you think you don’t need one by one you might be able to find out which one your code thinks you need.

all permissions on open npm modules after updating this issue

@cori i actually rely on snekfetch for several commands and it works fine lol this issue was from thw bot attempting to run a command when it does not have the proper permissions on the discord server

@cori aynı hatayı başka birisi de almış proje ip ban yemiş olabilir