Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.7K
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda