最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

next.js - Not able to read public file in vercel(server side) - Stack Overflow

programmeradmin0浏览0评论

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'
}
发布评论

评论列表(0)

  1. 暂无评论