Jan_
Jan_
DIAdiscord.js - Imagine an app
Created by Jan_ on 7/21/2024 in #djs-questions
Keep getting 500 Internal Server Error when editing messages
Hello discord.js community, Context Node version: 16.17.0 Discord js version: 14.9.0 I'm trying to implement a tournament calendar, that displays the next 50 tournaments of a game. The tournaments i'm getting from a third party api, and everything works how it supposed to on that end. The calendar is updating itself every 24h at 23:00 UTC. Updating the calendar 1. Fetch all upcoming tournaments 2. Build all embeds to send 3. Fetch all messages that are associated with the calendar (i save the snowflakes of the messages in the database, to check which messages are associated with that calendar) 4. Edit all messages with the new embeds. (Also delete/send new messages when there is a need for it) I limited the embeds per message at 9. For each update run of the calendar, im updating around 15 Messages. This means around 30 requests to the discord api. (15 for fetching and 15 for updating). These numbers might not be completely accurate but around the same ballpark should be the actual numbers. The error I get this error at least one time in an update run and it messes everything up, so that the calendar is not displayed correctly. I just cannot seem to find a fix for it.
HTTPError: Internal Server Error
at handleErrors (/node_modules/@discordjs/rest/dist/index.js:633:11)
at SequentialHandler.runRequest (/node_modules/@discordjs/rest/dist/index.js:1021:29)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/node_modules/@discordjs/rest/dist/index.js:862:14)
at async REST.request (/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async MessageManager.edit (/node_modules/discord.js/src/managers/MessageManager.js:176:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [Array],
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
status: 500,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/{channelId}/messages/{messageID}'
}
HTTPError: Internal Server Error
at handleErrors (/node_modules/@discordjs/rest/dist/index.js:633:11)
at SequentialHandler.runRequest (/node_modules/@discordjs/rest/dist/index.js:1021:29)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/node_modules/@discordjs/rest/dist/index.js:862:14)
at async REST.request (/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async MessageManager.edit (/node_modules/discord.js/src/managers/MessageManager.js:176:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [Array],
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
status: 500,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/{channelId}/messages/{messageID}'
}
The {channelId} and {messageId} are actual snowflakes in the error message. I also checked that the channel and message actualy exists and they both do for the past 5 times i got this error. What i already tried Spreading the requests, that not all come in at the same time (Fetch all messages, wait 1 second, then edit the messages) I thought it has something to do with rate limiting, but then i would see a 429 error status and not a 500. Thank you so much if you read this far. Any help would be appreciated.
7 replies