channel.createWebhook() returning Request Aborted

I can't seem to understand why this is happening. I'm trying to create a channel webhooi and it thinks about it for 30s then outputs this error:
RequestAbortedError [AbortError]: Request aborted
at RequestHandler.abort (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\undici\lib\client.js:1391:44)
at abort (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\undici\lib\api\abort-signal.js:9:10)
at self.<computed> (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\undici\lib\api\abort-signal.js:30:5)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
at EventTarget.dispatchEvent (node:internal/event_target:742:26)
at abortSignal (node:internal/abort_controller:369:10)
at AbortController.abort (node:internal/abort_controller:391:5)
at Timeout.<anonymous> (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\@discordjs\rest\dist\index.js:637:47)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7) {
code: 'UND_ERR_ABORTED'
}
RequestAbortedError [AbortError]: Request aborted
at RequestHandler.abort (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\undici\lib\client.js:1391:44)
at abort (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\undici\lib\api\abort-signal.js:9:10)
at self.<computed> (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\undici\lib\api\abort-signal.js:30:5)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
at EventTarget.dispatchEvent (node:internal/event_target:742:26)
at abortSignal (node:internal/abort_controller:369:10)
at AbortController.abort (node:internal/abort_controller:391:5)
at Timeout.<anonymous> (C:\Users\Andrew\Documents\GitHub\thp-services\node_modules\@discordjs\rest\dist\index.js:637:47)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7) {
code: 'UND_ERR_ABORTED'
}
try {
console.log(13);
webhook = await interaction.channel.createWebhook({ name: `${category.toLowerCase()} (${type.toLowerCase()})`, avatar: interaction.client.user.avatarURL() });
console.log(webhook);
}
try {
console.log(13);
webhook = await interaction.channel.createWebhook({ name: `${category.toLowerCase()} (${type.toLowerCase()})`, avatar: interaction.client.user.avatarURL() });
console.log(webhook);
}
9 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs4mo ago
AbortError: The user aborted a request. A request took longer than the specified timeout (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 timeout option in RESTOptions can be increased to prevent future AbortErrors.
AJ
AJ4mo ago
@Qjuh what could be the reason it takes ages to create a webhook? This happens on both my production and staging environment? I don't think it's the code, the code is simple enough. My average latency to the Discord API is 1 second. I've fixed this temporarily by raising the timeout to 30s, but this is too slow. Other discord requests don't take this long on my client Yeah, still gets created fine. It only fails if it reaches the timeout Not really a consistent thing. People use a /serverpost command to post images into their channel w/webhooks. So i'd say one webhook gets created ever hour or so So for example, if I have 50 channels being posted to currently, creating a new webhook would be slower to create? But, I surely can't be hitting rate limits if it happens on both prod and stag two diff tokens two diff IPs Stag has no serverposts So it shouldn't be hitting the rate limit No sorry, not in one server at a time Spread across multiple guilds I know the integration limit is 50, which I dont like lol I thought there was no rate limits on sending to webhooks? I had like 500 serverposts setup across different servers and I was using messages instead of webhooks. I was told that webhooks have higher rate limits than sending message content. 500 would cause me to hit the rate limits. So I had to switch to webhooks. Sending one still uses a webhook request tho right, doesn't that count towards the overall rate limit? I'll test this btw hmm okay let me check this rate limit event and i'll get back to you thanks for helping so far Nah A serverpost is posting images to a server channel every few seconds. Min 10, Max 60 seconds. it creates a webhook upon starting it. Then if it fails three times, it deletes the webhook and stops. Or if the user stops it, it will delete the webhook as well. How come? Upon the user using the command /serverpost start /serverpost stop Webhooks do not get created more than the rate limit allows. That's for definite. Console logs shows users use this command (on average) once or twice per hour. We log when webhooks are created in console Also w#e don't log usage of specific commands, but overall interactions we do. Yeah okay about to push to prod @Qjuh this event only emits when we hit a rate limit, is this correct? @Qjuh nothing at all. I use the command, it thinks about it for about 20s, then it works but it shouldn't be taking 20s The delay only occurs when it starts to create the webhook I console.log numbers up until this point and they output to console fine and fast. So it's defo the creation of the webhook that's the problem yeah two files
d.js docs
d.js docs4mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
AJ
AJ4mo ago
This is the main command file.
AJ
AJ4mo ago
Pastebin
case 'start' : { await deferReply().catch(console.er...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
AJ
AJ4mo ago
Then Here is the function beginServerposting
AJ
AJ4mo ago
Pastebin
async function beginServerposting(interaction, type, category, seco...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
AJ
AJ4mo ago
If it takes longer than the REST timeout, it will show the "There was a problem" embed. nope lol yeah we haven't changed the icon lol hmm actually no we don't check that we should The servers in question have no more than like, 10 integrations lmao People reached out about the issue, I can see it physically in their server In the guild and channel integration settings I just seen in the guild integrations (not channel) and they amounted to 10 or so a very weird issue imo Can't seem to get to the bottom of it. lmaoo i didn't even know they existed I thought integrations as a whole Like, bots and webhooks combined Did you have the answer to this? I no longer need it but I’m curious as to what the answer is lol