When adding an attachment with just filename and content (both required), the library throws an error "Expected the attachment's type field to be a string". Type is not required per the spec here https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html
const data = {
personalizations: [{ to: [{ email: '[email protected]' }] }'],
from: {
email: '[email protected]',
},
subject: 'subject',
template_id: 'd-111111111111',
atttachments: [{
content: 'blah blah',
filename: 'test.txt',
}]
}
await sgMail.send(data);
" at Mail.setAttachments (/app/node_modules/@sendgrid/helpers/classes/mail.js:445:13)",
" at Mail.fromData (/app/node_modules/@sendgrid/helpers/classes/mail.js:82:10)",
" at new Mail (/app/node_modules/@sendgrid/helpers/classes/mail.js:46:12)",
" at Function.create (/app/node_modules/@sendgrid/helpers/classes/mail.js:670:12)",
" at MailService.send (/app/node_modules/@sendgrid/mail/src/classes/mail-service.js:188:25)",
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.
Same issue with disposition field: https://github.com/sendgrid/sendgrid-nodejs/issues/1179
This issue should have been resolved by https://github.com/sendgrid/sendgrid-nodejs/pull/1198, which hasn't been released yet released
@TheOptimisticFactory Thanks! Forget to check linked issues. Closing as the work is done and this will be released later today.
Most helpful comment
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.