Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.8K
Views
Discord.js: AbortError: The user aborted a request

I have been working on my ticket system and its transcript logging process, and one day this error started showing up and transcripts started to fail sending. This didn't use to be a thing before. The full error is:

[Error Handling System] Multiple Resolves
reject Promise {
  <rejected> AbortError: The user aborted a request.
      at abort (/PC/Bot/bot/node_modules/discord.js/node_modules/node-fetch/lib/index.js:1448:16)
      at EventTarget.abortAndFinalize (/PC/Bot/bot/node_modules/discord.js/node_modules/node-fetch/lib/index.js:1463:4)
      at EventTarget.[nodejs.internal.kHybridDispatch] (node:internal/event_target:460:20)
      at EventTarget.dispatchEvent (node:internal/event_target:405:26)
      at abortSignal (node:internal/abort_controller:97:10)
      at AbortController.abort (node:internal/abort_controller:122:5)
      at Timeout.<anonymous> (/PC/Bot/bot/node_modules/discord.js/src/rest/APIRequest.js:72:49)
      at listOnTimeout (node:internal/timers:557:17)
      at processTimers (node:internal/timers:500:7) {
    type: 'aborted'
  }
}

My code is:

setTimeout(() => {
    interaction.channel.delete({ reason: `[Ticket System] Ticket Closed` }).then(async ch => {
      const mdb = require('./../models/tickets')
      mdb.findOne({ Channel: ch.id }, async (err, data) => {
        if (err) throw err;
        if (data) {
          const openedBy = interaction.guild.members.cache.get(ch.topic.split(" ").splice(1).toString())
          fs.writeFileSync(`../${ch.name} - ${ch.id}.txt`, data.Content.join("\n\n"))
          let embed = new Discord.MessageEmbed()
            .setTitle("Ticket Closed")
            .addField("<:ticket1:872962350473433089> Ticket Name", `${ch.name} (${ch.id})`)
            .addField(`<:person:890913045457563718> Opened By`, `${openedBy}`)
            .addField("<:admin:872930262516908113> Closed By", `${interaction.user} (${interaction.user.id})`)
            .addField(`<:open:914148680959934514> Open Time`, `<t:${moment(ch.createdTimestamp).format("X")}>`)
            .setTimestamp()
            .setFooter({ text: `ID: ${uuidv4()}` })
          const atta = new Discord.MessageAttachment(fs.createReadStream(`../${ch.name}-${ch.id}.txt`))
          const logChannel = client.channels.cache.get(transcripts_channel);
          logChannel.send({ embeds: [embed], files: [atta] })
          mdb.findOneAndDelete({ Channel: ch.id })
        }
      })
    })
  }, 10000)

I have tried removing MongoDB parts, tried decreasing the timeout and many more... None of those helped.

Thanks in advance!

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

That's Discord API error, Discord receives a request from discord.js but takes too long to process so it's aborted. For more information this issue and this discord.js pull request.

over 4 years ago · Santiago Trujillo Report

0

Tag from official discord.js server:

AbortError: The user aborted a request.
A request took longer than the specified restRequestTimeout (15 seconds default), and was aborted to not lock up the request handler.
• This can be caused by an internal server error on Discord's side, or just a slow connection.
• In case of a slow connection, the restRequestTimeout option in ClientOptions can be increased to prevent future AbortErrors.

Check that your internet is stable, and that Discord isn't having any issues (status page). Can you visit https://discord.com/app in your browser? Do you have a proxy or VPN enabled?

If it's still happening, you can try the second option, which is to change the restRequestTimeout in your Client constructor.

const client = new Client({
  restRequestTimeout: 60000 // change the timeout to 1 minute
  // other options like your intents...
});
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!