I am trying to send mail using nodemailer and want to pass html template to the nodemailer but not able to read the file on vecel. But it is working without any issue on my localhost.
const orderConfirmationTemplatePathForUser = "/public/mailTemplates/orderConfirmationTemplate.html";
const sourceForUser = (await fs.readFile(process.cwd() + orderConfirmationTemplatePathForUser, 'utf8')).toString();
folder structure(both src and public are at same level)
/src
/public
--/mailTemplates
----/orderConfirmationTemplate.html
Getting the below error only in vercel
[Error: ENOENT: no such file or directory, open '/var/task/public/mailTemplates/orderConfirmationTemplate.html'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/var/task/public/mailTemplates/orderConfirmationTemplate.html'
}