discord.js: Retry limit on HTTPError [AbortError]

Hi there,

As many people, I got time to time the HTTPError [AbortError]. It’s always frustrating to get it on message.send or little api call like that, when you have another just 2 lines after that works without issue.

Describe the ideal solution A solution could be to have a ‘retry’ limit on the HTTPError [AbortError], as increasing the restRequestTimeout doesn’t really help, because 15s is already long. I’m not observing any ping increase or a big increase of request on my server when it happened, so it looks like to be more between discord and the bot only. A retry limit could help to fix this.

Describe alternatives you’ve considered I did try to increase the restRequestTimeout as I said, but it seems that it still happens time to time (Like once every few days).

Thanks by advance for the answer and the consideration 😄

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 45 (10 by maintainers)

Most upvoted comments

It’s something I have considered adding in https://github.com/discordjs/discord.js/pull/3443, which would add the requests that time out at the end of the rest queue, and try it again later. I’ll experiment with it later

ratelimits.

I have had this problem for 2 weeks. Any solution please?

Yea sometimes a file upload fails

Upload speed is 3mbps, would a faster internet connection prevent these issues?

A library shouldn’t really be implementing error handling though - it does exactly what it should do and throws/rejects an Error with appropriate information to you, the developer.

Its then up to you how you want to handle errors.

Your example of sending the error to the user isn’t really a great idea because as you’ve pointed out, doing that relies on the same API that may have thrown the error in the first place. Error handling should be doing things logging it locally for analysis, correcting any local cache etc.

This is actually the DIY way to do it, but not efficient. Also if you have to do it for everything in your code (and not only send message that contact the discord API), it can become a nightmare.

The issue has to be resolved into the RequestHandler. Sadly as I exposed in the previous message, I don’t really have the level to do it, and this post is just an enhancement proposal, maybe it can be also considered as a bug with the previous point exposed? (but it need to be read by one of the dev)

Thanks vladfrangu! I will follow your PR and see how it goes.