Discord.js: Channels in memory cannot have messages sent to them

Created on 23 Aug 2018  Â·  14Comments  Â·  Source: discordjs/discord.js

Please describe the problem you are having in as much detail as possible:
Certain channels in memory cannot have messages sent to them. I have not been able to determine what makes this channels chosen to geek out. These channels will have all permissions granted, but the message.reply() and/or channel.send() will never finish/return. There is also no error, warning, nothing...

Here is some screenshots documenting the issue using the code below:
Screenshot of permissions: https://i.imgur.com/Ou9yqbi.png
Screenshot of issue: https://i.imgur.com/3e44Yt5.png

Include a reproducible code sample here, if possible:


module.exports = {
    name: 'chantest',
    description: 'Test Channel Issue Function',
    args: true,
    ownersOnly: true,
    async execute(prefix, lang, command, message, args, db) {
        try{
            var chan = await message.client.channels.get(args[0]);
            if(chan){
                message.reply("Preparing to send to channel name `" + chan.name + "`.");
                var sentMsg = await chan.send(new Date().valueOf());
                if(sentMsg){
                    return message.reply("Done sending message ID#" + sentMsg.id + " to channel ID#" + sentMsg.channel.id);
                }else{
                    return message.reply("Sent message was null/undefined.");
                }
            }else{
                return message.reply("Invalid channel ID!");
            }
        }catch (err){
            console.log(err);
            message.reply(err.message);
            throw err;
        }
    }
};

Further details:

  • discord.js version: Latest
  • Node.js version: Latest
  • Operating system: Ubuntu 18 / Mac OS X
  • Priority this issue should have – please be realistic and elaborate if possible: Medium - only a few channels are affected, and a restart(clear of cache, and reload) fixes it.
  • [ ] I found this issue while running code on a __user account__
  • [x] I have also tested the issue on latest master, commit hash: 82993fb
medium REST bug

All 14 comments

What is causing this is node-fetch erroring, and the rest item not being rejected allowing the queue to continue. This is fixed in: #2694

@bdistin Do you know of timing plans to merge that PR? Is there a way to see what the node fetch error is right now?

Landed in 13f46b924be15371f377d3c5f128ac75ac98e4b4

Thank you @iCrawl

@iCrawl @bdistin I believe the bug may be continuing in a different form... Now it returns null for these given channels with issues when trying to fetch them.

Edit: And the original issue still exists... :/

what could be the issue this time.. If this was fixed in the lastest update then there has to be something else that was missed

@iCrawl is there a temporary fix for this? It is getting terrible.. Now channels are breaking in the middle of commands

Just in case, since this kind of bug is pretty rare to find and reproduce, what commit of master are you using? This issue should be most likely fixed as of 13f46b924be15371f377d3c5f128ac75ac98e4b4, which is a three day old commit.

You can use the following command to get the commit hash:

npm ls discord.js

[email protected] /var/www/Monstacord
└── discord.[email protected] (github:discordjs/discord.js#9c2aeb733a35c81f2d1b6261bea430cb9eeb6c13)

@kyranet

Just to verify this is a REST issue about requests being blocked (what we suspected first, since it's the only known way to get messages to never send but also never error), if you have an eval command, can you execute the following code?

// Replace message.channel.id with an affected channel's id
client.rest.handlers.get(`/channels/${message.channel.id}/messages`);

Ideally, it should show something like this (or simply undefined):

RequestHandler {
  manager: [RESTManager],
  busy: false,
  queue: [],
  reset: 1535321567836,
  remaining: 4,
  limit: 5,
  retryAfter: -1 }

If busy is true but the queue is empty or resetTime is null, then this is indeed a REST issue, otherwise it'd most likely be something in your code (since this bug is fixed in latest master)

@kyranet its not returning anything at all

Can you be more specific about its return value, please? You can reach me in the Discord server as kyra#0001 so we can investigate this issue further and faster without disturbing any collaborator subscribed to this thread.

@kyranet worked with @Gamercord (Mike) and even when directly running

client.rest.handlers.get("/channels/${CHAN_ID}/messages"); we also did not get anything returned/errored, nothing.

Can this be considered verified now?

2801 from @kyranet fixes our issue, after testing over 500 channels, none are broken! This bug can be closed after #2801 is merged!

Was this page helpful?
0 / 5 - 0 ratings