Unable to Show Modal

I'm currently trying to show a basic modal to users after they select an option from a drop down menu. Currently, I seem to be running into an error with this line: return interaction.showModal(modal);, and I'm not really sure how to interpret my console errors beyond "something is wrong with the fields I'm adding to TextInputBuilder."

In VS Code, I am seeing that .setLabel is marked as deprecated, but it also seems to be what the Discord.js documentation indicates I should be using? Any help would be appreciated!

Below I'm including the snippet of code that seems to be the issue, my console log errors, and my package.json:

Problematic Code:

console.log("Attempting to show modal for community note...");
const modal = new ModalBuilder()
    .setCustomId(`noteModal:${noteId}`)
    .setTitle('Enter Your Note');

const noteInput = new TextInputBuilder()
    .setCustomId('noteContentInput')
    .setLabel('Note Content')
    .setValue('Note Content')
    .setPlaceholder('Explain the missing context…')
    .setStyle(TextInputStyle.Paragraph)
    .setRequired(true);

console.log(noteInput);

const row = new ActionRowBuilder().addComponents(noteInput);

console.log('Here lies Row:', row.components);
modal.setLabelComponents(row);

try {
    console.log(modal);
    return interaction.showModal(modal);
} catch (modalErr) {
    console.error('Error showing modal:', modalErr);
    return interaction.reply({
        content: 'There was an error displaying the note input modal.',
        ephemeral: true
    });
}
Was this page helpful?