Hi everybody!
- The site name is ferienwohnung-vogtland.netlify.app.
- The custom domain is ferienwohnung-vogtland.com
I have a problem or misunderstanding of netlify functions. I would like to send an email with mailgun after a successful purchase. I have a handlebars file right next to my netlify function in a folder inside the functions directory like this:
functions >sendEmail> sendEmail.js & email.hbs
In local development with netlify dev I am able to load the hbs file without issue, but in production the email file is not found when the function is called. I have googled and found a thread talking about something similar:
The proposed solutions of using:
const emailTemplateSource = fs.readFileSync( require.resolve("./email.hbs") );
or
const currentDir = process.env.LAMBDA_TASK_ROOT;
const emailTemplateSource = fs.readFileSync( path.join(currentDir, "sendEmail/email.hbs"));
both do not work for me. Maybe someone can point to a simple mistake I did or if their is a possible limitation of netlify functions I am not aware of.
Thank you very much in advance