I am trying to send email in NestJs but seems to stuck at a weird error.
TypeError: Cannot destructure property 'templateName' of 'precompile(...)' as it is undefined.
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at new NodeError (node:internal/errors:363:5)
at ServerResponse.setHeader (node:_http_outgoing:573:11)
I am not sure what's going on the only solution I was able to find was to put ''./'' in front of the template names but I am not sure why would that work also it isn't even working in my case.
This is how i am trying to send it
this.mailService.sendEmail(
emailAddress,
[], // cc
[], // bcc
"Pretty Subject Line", // subject
"./verify-email", // template
{ // context
name: "tetsName",
verifyLink
}
);
templates folder is in root directory