TypeError: import_undici4.FormData is not a constructor

I get this error : TypeError: import_undici4.FormData is not a constructor
when i try to send an attachment

Code :
const canvas = Canvas.createCanvas(700, 250);

const ctx = canvas.getContext('2d');

ctx.fillStyle = `${res.data.banner_color}`;

ctx.fillRect(0, 0, canvas.width, canvas.height);

const attachment = new AttachmentBuilder(canvas.toBuffer("image/png"), { name: "banner.png" });

embed.setImage(`attachment://${attachment.name}`);

await interaction.reply({ embeds: [embed], files: [attachment] })
Was this page helpful?