Error: Cannot properly serialize component type:

While refactoring and sourcing out some modals into external files, i encountered this error. Ive been trying for a few hours so im 100% sure its the exact same code. Ive also tried the modal tutorial code from the discordjs wiki and could reproduce the error when putting it in a function that returns a modal which resides in a different file.
1 Reply
fantasy
fantasy2y ago
This is the complete error message:
[ERROR] Encountered error while handling an interaction handler run method for interaction-handler "ticketmenuselect" at path "project\dist\interaction-handlers\ticketmenuselect.js" Error: Cannot properly serialize component type: undefined
at createComponentBuilder (project\node_modules\@discordjs\builders\src\components\Components.ts:100:10)
at <anonymous> (project\node_modules\@discordjs\builders\src\components\ActionRow.ts:103:53)
at Array.map (<anonymous>)
at ActionRowBuilder (project\node_modules\@discordjs\builders\src\components\ActionRow.ts:103:34)
at <anonymous> (project\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:74:8)
at Array.map (<anonymous>)
at ModalBuilder.addComponents (project\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:71:34)
at other (project\src\tickets\ticketModal.ts:193:8)
at MenuHandler.run (project\src\interaction-handlers\ticketmenuselect.ts:47:17)
at <anonymous> (project\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:36:28
[ERROR] Encountered error while handling an interaction handler run method for interaction-handler "ticketmenuselect" at path "project\dist\interaction-handlers\ticketmenuselect.js" Error: Cannot properly serialize component type: undefined
at createComponentBuilder (project\node_modules\@discordjs\builders\src\components\Components.ts:100:10)
at <anonymous> (project\node_modules\@discordjs\builders\src\components\ActionRow.ts:103:53)
at Array.map (<anonymous>)
at ActionRowBuilder (project\node_modules\@discordjs\builders\src\components\ActionRow.ts:103:34)
at <anonymous> (project\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:74:8)
at Array.map (<anonymous>)
at ModalBuilder.addComponents (project\node_modules\@discordjs\builders\src\interactions\modals\Modal.ts:71:34)
at other (project\src\tickets\ticketModal.ts:193:8)
at MenuHandler.run (project\src\interaction-handlers\ticketmenuselect.ts:47:17)
at <anonymous> (project\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:36:28
Figured it out: I imported ActionRowBuilder, TextInputBuilder and from @discordjs/builders while they need to be imported from discord.js
Want results from more Discord servers?
Add your server