N
Novu•3y ago
Kristof

Attachements not being received by providers [typo]

Hi all, We need to attach a pdf to emails we are sending. We followed the guidelines of the setup and it all seems to work inside of Novu (no error reported and Buffer received in interface). However the email that we receive does not have the attachement. We tried it with sendgrid and sendinblue with the same result. We also tried changing the file content from buffer to base64 and neither worked. Do you guys have any ideas? Using the Novu hosted instance. Happy to share more details if needed?
13 Replies
Novu_Bot
Novu_Bot•3y ago
@kristofdt, you just advanced to level 1!
Pawan Jain
Pawan Jain•3y ago
How are you sending attachment? May be some code snippet?
Kristof
KristofOP•3y ago
{
firstName: account.first_name,
lastName: account.last_name,
studentBio: account.short_bio,
studentLogo: account.image_url,
institute: account.institutes[0].name,
attachements: [
{
file: fs.readFileSync(fileLocation),
mime: 'application/pdf',
name: `${account.last_name}_${account.first_name}_cv.pdf`,
channels: [ChannelTypeEnum.EMAIL],
},
],
EOName: entity.name,
type: account.education_level?.name_en ?? 'Not provided',
companyName: entity.company.name,
location: entity.company.city,
}
{
firstName: account.first_name,
lastName: account.last_name,
studentBio: account.short_bio,
studentLogo: account.image_url,
institute: account.institutes[0].name,
attachements: [
{
file: fs.readFileSync(fileLocation),
mime: 'application/pdf',
name: `${account.last_name}_${account.first_name}_cv.pdf`,
channels: [ChannelTypeEnum.EMAIL],
},
],
EOName: entity.name,
type: account.education_level?.name_en ?? 'Not provided',
companyName: entity.company.name,
location: entity.company.city,
}
This is the payload body that is triggered. We tried a number of variations on the file and also added a content field with the same value
Pawan Jain
Pawan Jain•3y ago
Why are you sending channels field in attachment?
Kristof
KristofOP•3y ago
It is one of the optional fields in the trigger typing. We also tried it without it. The worklfow is also a single step with only the email. We also looked through the Novu coedbase for the implementation of the attachements and it does seem to be correct with the sdk's. I tried tracing a message through the code base to verify the correct data flows but I got lost. Hoping someone else can verify the attachement functionalities?
Pawan Jain
Pawan Jain•3y ago
Seeing above code snippet, everything seems to be ok
Kristof
KristofOP•3y ago
That was also our conclusion 😄 which is why I reached out I also tried with a .png and it does not work. I did have a typo first in the mime type and it did not throw any errors. I don't know if this has any impact or where it is validated and used? As far as I see it there are 3 points where this flow can have an error after it is received in novu 1. Inside of the provider: Unlikely since we have already sent emails through them with attachements. 2. The way Novu sends requests to the provider: Also looks in line with the sdk's and guides that they provide so unlikely as well. 3. Somewhere in the internal flow of Novu the attachements is mapped or changed. I don't know the code base well enough to identify this and I think this is most likely the issue. It would be nice if this could be checked and tested?
Pawan Jain
Pawan Jain•3y ago
Recently we fixed one issue related to attachment
Kristof
KristofOP•3y ago
Yes, I checked that before posting this thread. Might be interesting to involve the same people in this thread as well?
Novu_Bot
Novu_Bot•3y ago
@kristofdt, you just advanced to level 2!
Prosper
Prosper•3y ago
Please can you check the spelling of attachments. In this code, it is spelled as "attachements" instead of "attachments" @kristofdt
Kristof
KristofOP•3y ago
@unicodeveloper It works! I am so sorry 😅 Added to my list of typo's I'll never make again
Prosper
Prosper•3y ago
Haha, happens to the best of us. Just glad it's working now.

Did you find this page helpful?