Cannot use ejs template in nodemailer lambda function due to file not being available

I am using a lambda function to send an email using nodemailer which also uses ejs to build a html template that will get sent. My issue is when using ejs.renderFile in the lambda it cant locate the file as I believe only the functions get zipped and uploaded. How do I zip up extra files for the lambda function to access? my mail.js lambda needs to use mailTemplate.ejs and my file structure is below:-

folder structure -

  • templates
    - mailTemplate.ejs


I don’t know if this is the best way, but one way is to build locally and send us only the function zip, the third example in this repo:

Then you can include the file there. The other options may do what you want with some work too, - the second one specifically I think is better suited to this.