NyR
NyR
DIAdiscord.js - Imagine an app
Created by NyR on 7/25/2024 in #djs-questions
TypeError: Cannot read properties of undefined (reading '_add') on InteractionWebhook.send() call
I have been getting this error randomly for some time
TypeError: Cannot read properties of undefined (reading '_add')
at InteractionWebhook.send (/root/skyhelper/node_modules/discord.js/src/structures/Webhook.js:232:66)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (file:///root/skyhelper/dist/src/commands/slash/info/daily-quests.js:17:19)
at async interactionHandler (file:///root/skyhelper/dist/src/events/interactionCreate.js:33:13)
TypeError: Cannot read properties of undefined (reading '_add')
at InteractionWebhook.send (/root/skyhelper/node_modules/discord.js/src/structures/Webhook.js:232:66)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (file:///root/skyhelper/dist/src/commands/slash/info/daily-quests.js:17:19)
at async interactionHandler (file:///root/skyhelper/dist/src/events/interactionCreate.js:33:13)
Happens when using slash commands At first, I thought maybe it was because the command was used in an uncached channel (as an user app), but looking at the source here https://github.com/discordjs/discord.js/blob/main/packages%2Fdiscord.js%2Fsrc%2Fstructures%2FWebhook.js#L232, the optional chaining (?) should short circuit, also it's actually messages property that's undefined, which confuses me. Because from my understanding, the channel returned shoukd be a TextChannel since slash commands can only be used in those (right ?). So I have no idea what channel type it's getting there. I tried to reproduce this multiple times myself with no avail, it only happens sometimes rarely
7 replies