TypeError: component.toJSON is not a function

Code: https://sourceb.in/CshyWb9hcA Error:
TypeError: component.toJSON is not a function
at C:\Users\luizs\Valor\Valor\node_modules\@discordjs\builders\dist\index.js:1310:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\luizs\Valor\Valor\node_modules\@discordjs\builders\dist\index.js:1310:35)
at C:\Users\luizs\Valor\Valor\node_modules\discord.js\src\structures\MessagePayload.js:136:109
at Array.map (<anonymous>)
at MessagePayload.resolveBody (C:\Users\luizs\Valor\Valor\node_modules\discord.js\src\structures\MessagePayload.js:136:49)
at GuildForumThreadManager.create (C:\Users\luizs\Valor\Valor\node_modules\discord.js\src\managers\GuildForumThreadManager.js:64:8)
at Object.<anonymous> (C:\Users\luizs\Valor\Valor\build\Events\Interaction\interactionCreate.js:73:64)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\luizs\Valor\Valor\build\Events\Interaction\interactionCreate.js:5:58)
TypeError: component.toJSON is not a function
at C:\Users\luizs\Valor\Valor\node_modules\@discordjs\builders\dist\index.js:1310:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\luizs\Valor\Valor\node_modules\@discordjs\builders\dist\index.js:1310:35)
at C:\Users\luizs\Valor\Valor\node_modules\discord.js\src\structures\MessagePayload.js:136:109
at Array.map (<anonymous>)
at MessagePayload.resolveBody (C:\Users\luizs\Valor\Valor\node_modules\discord.js\src\structures\MessagePayload.js:136:49)
at GuildForumThreadManager.create (C:\Users\luizs\Valor\Valor\node_modules\discord.js\src\managers\GuildForumThreadManager.js:64:8)
at Object.<anonymous> (C:\Users\luizs\Valor\Valor\build\Events\Interaction\interactionCreate.js:73:64)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\luizs\Valor\Valor\build\Events\Interaction\interactionCreate.js:5:58)
14 Replies
d.js toolkit
d.js toolkit14mo 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!
ShompiFlen
ShompiFlen14mo ago
i want to ask why are you casting this const displayEmbed = new EmbedBuilder() as any as any whats the point check these rows
const addMutationRow = new ActionRowBuilder(tempObj.AddMutationRow)
const removeMutationRow = new ActionRowBuilder(tempObj.RemoveMutationRow)
const addMutationRow = new ActionRowBuilder(tempObj.AddMutationRow)
const removeMutationRow = new ActionRowBuilder(tempObj.RemoveMutationRow)
thats not how you create an action row from another row use const row = ActionRowBuilder.from(theotherRow)
Ashura
AshuraOP14mo ago
👍 changed it but still doesnt work same error
ShompiFlen
ShompiFlen14mo ago
send new code
Ashura
AshuraOP14mo ago
ShompiFlen
ShompiFlen14mo ago
yea can you log one of tempObj.mutationRow or the other one please im pretty sure that component is invalid the components on that object / row whatever you are storing there doesnt seem to be correct
Ashura
AshuraOP14mo ago
ActionRowBuilder {
data: { type: 1 },
components: [
ButtonBuilder { data: [Object] },
ButtonBuilder { data: [Object] }
]
}
ActionRowBuilder {
data: { type: 1 },
components: [
ButtonBuilder { data: [Object] },
ButtonBuilder { data: [Object] }
]
}
ShompiFlen
ShompiFlen14mo ago
<:AA_Menhera_Think:849596324118921216>
Ashura
AshuraOP14mo ago
this is where i save the actionrow in the db https://sourceb.in/0o51fnTYNE
ShompiFlen
ShompiFlen14mo ago
hm... im not entirely sure, but saving the entire row objects to the db like that doesnt seem like a good idea, you should probably save them as json, you can call toJSON() on them to save them as a json object instead, then you can basically reconstruc them using the method suggested before ActionRowBuilder.from(obj) although if you are using typescript this is going to be a bit troublesome, perhaps
Ashura
AshuraOP14mo ago
ill try that and let you know , thx for now it kinda works now cause i get no error , whatever i get this interaction failed and it seems like it isnt executing anything , ill do some checkpoints to check it actually forget it , im rlly dumb
Ashura
AshuraOP14mo ago
lol
No description
ShompiFlen
ShompiFlen14mo ago
interaction fails because you are not replying to the interaction
Ashura
AshuraOP14mo ago
im , i was just returning before defining the fields in the embed
Want results from more Discord servers?
Add your server