Error running a select menu inside a modal (not sure if that's really the issue)

I have this action row with a text box and a select menu which i put inside a modal that is activated with a button:
static cookieField = new ActionRowBuilder(
{
components: [
new TextInputBuilder({
custom_id: "cookieField",
label: "Hoyolab cookie string",
style: TextInputStyle.Short,
placeholder: "_MHYUUID=c19fda-29...",
required: true
}),
new StringSelectMenuBuilder({
custom_id: "serverPicker",
max_values: 1,
options: [
new StringSelectMenuOptionBuilder({
label: "American server", value: "1", emoji: { name: "πŸ‡ΊπŸ‡Έ" }
}),
new StringSelectMenuOptionBuilder({
label: "Europian server", value: "2", emoji: { name: "πŸ‡ͺπŸ‡Ί" }
}),
new StringSelectMenuOptionBuilder({
label: "Asian server", value: "3", emoji: { name: "🏳️" }
}),
new StringSelectMenuOptionBuilder({
label: "HW/TW/MO server", value: "4", emoji: { name: "πŸ‘Ž"}
})
]
})
]
}
);
static cookieField = new ActionRowBuilder(
{
components: [
new TextInputBuilder({
custom_id: "cookieField",
label: "Hoyolab cookie string",
style: TextInputStyle.Short,
placeholder: "_MHYUUID=c19fda-29...",
required: true
}),
new StringSelectMenuBuilder({
custom_id: "serverPicker",
max_values: 1,
options: [
new StringSelectMenuOptionBuilder({
label: "American server", value: "1", emoji: { name: "πŸ‡ΊπŸ‡Έ" }
}),
new StringSelectMenuOptionBuilder({
label: "Europian server", value: "2", emoji: { name: "πŸ‡ͺπŸ‡Ί" }
}),
new StringSelectMenuOptionBuilder({
label: "Asian server", value: "3", emoji: { name: "🏳️" }
}),
new StringSelectMenuOptionBuilder({
label: "HW/TW/MO server", value: "4", emoji: { name: "πŸ‘Ž"}
})
]
})
]
}
);
2 Replies
d.js toolkit
d.js toolkitβ€’10mo 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! - βœ… Marked as resolved by OP
aa battery
aa batteryβ€’10mo ago
when that button is clicked and the api.interactions.createModal() is ran for that action row i get this error
ValidationError > s.string
Expected a string primitive

Received:
| undefined

at StringValidator.handle (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@sapphire\shapeshift\dist\index.js:1715:70)
at StringValidator.parse (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@sapphire\shapeshift\dist\index.js:212:88)
at validateRequiredSelectMenuOptionParameters (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:543:34)
at StringSelectMenuOptionBuilder.toJSON (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:506:5)
at C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1017:52
at Array.map (<anonymous>)
at StringSelectMenuBuilder.toJSON (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1017:29)
at C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1310:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1310:35)
ValidationError > s.string
Expected a string primitive

Received:
| undefined

at StringValidator.handle (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@sapphire\shapeshift\dist\index.js:1715:70)
at StringValidator.parse (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@sapphire\shapeshift\dist\index.js:212:88)
at validateRequiredSelectMenuOptionParameters (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:543:34)
at StringSelectMenuOptionBuilder.toJSON (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:506:5)
at C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1017:52
at Array.map (<anonymous>)
at StringSelectMenuBuilder.toJSON (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1017:29)
at C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1310:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\mt\Documents\me stuff\prog\Visual Studio Code\genshinBot\node_modules\@discordjs\builders\dist\index.js:1310:35)
the @discordjs docs is mostly just guesswork for me so if someone can help that'd be nice (im not sure what the issue is btw)