Attempting to use Trello's Create card attachment with a 8kb PNG file, I am getting a 'File too large' error in return.
code sample:
const image = await sharp(
"path/qrcode.png"
)
.resize(200, 200)
.webp({ quality: 20 })
.toFormat("png")
.toBuffer();
// * CREATE NEW CARD WITH LIST ID
await axios
.post(
`https://api.trello.com/1/cards?idList={LISTKEYHERE}&key=${TRELLO_KEY}&token=${TRELLO_TOKEN}`,
{
name: "Create new card",
pos: "top",
}
)
.then((res) => {
const id: any = res.data.id;
axios.post(
`https://api.trello.com/1/cards/${id}/attachments?key=${TRELLO_KEY}&token=${TRELLO_TOKEN}`,
{ file: image }
);
});
I've read from other injuries that the free version of trello allows a 10mb upload for attachments, the image being 8kb should be well under that limit.
I also tested to see if the front end of trello boards allows the image to be manually attached, the same file works fine from the UI end.
Notes: Instead of making the separate call for creating an attachment, I also attempted the key value parameters for the initial call for creating a card's (fileSource) as well. Same error.