sendGrid email API attachments

Hey guys, Need some help with this one -

  1. I preform a data query,
  2. save results.items as a string with JSON.stringify
  3. convert file content to base64 format
  4. build the attachment object and attach it to email.

The result:

  • The email is sent with correct details
  • The email contains an attachment, but the attachment content contains the file info + base64 content data.
    The attachment file name is empty. it was not created as expected.

** Attacehd is a photo of the data file content


Can you provide the code?