Deploy app using Nodemailer-express-handlebars + nodemailer to send emails on vercel

ERROR [Error: ENOENT: no such file or directory, open '/var/task/src/mailer/templates/invite.html'] { errno: -2, code: 'ENOENT', syscall: 'open', path: '/var/task/src/mailer/templates/invite.html' this is the error am getting. how do i point it to the correct directory or does this file even exists in the context of this function?
4 Replies
Krayola
Krayola14mo ago
I'm getting this exact error on the vercel deployment, but it works fine on my local build
Krayola
Krayola14mo ago
@bayo found an answer that worked for me on a vercel deployment https://github.com/ericf/express-handlebars/issues/269#issuecomment-559134248
GitHub
Nodemailer + Handlebars + NextJS - The correct path · Issue #269 · ...
I'm experiencing problems to find the right path settings in production for my nodemailer/handlebars setup. The transporter is connected to an API request in order to send an automatic email. I...
Krayola
Krayola14mo ago
so it was just adding this in the script that uses nodemailer-express-handlebars
const path = require('path')
...
viewPath: path.resolve(YOUR_DESIRED_PATH),
...
const path = require('path')
...
viewPath: path.resolve(YOUR_DESIRED_PATH),
...
baotaoh
baotaoh14mo ago
Yo thats great! Thank you , i was just thinking about this the other day.