You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stacktrace:
at assertPath (path.js:28:11)
at Object.resolve (path.js:1171:7)
ExpressHandlebars._resolveLayoutPath
This issue is caused by the dependency: ExpressHandlebars.
Underlying issue is because of a change in ExpressHandlebars, it will use defaultLayout='main' no matter what, as such it expects the layoutDir to be a string however for users who do not use a layout, like in my case, it will throw this error 'Path must be a string ...'
Just putting this issue here so that people who might have this issue can know a quick fix:
Whenever you generate your mailOptions, set your context.layout=false.
This would override the defaultLayout in ExpressHandlebars to be false and not produce this bug.
The real fix would have to be implemented by ExpressHandlebars which there are requests to remove the defaultLayout.
if a patch wants to be made in nodemailer-express-handlebars, I was thinking a quick fix could be adding the following to the render function:
TemplateGenerator.prototype.render = function render(mail, cb) {
if (mail.data.html) return cb();
var templatePath = path.join(this.viewPath, mail.data.template + this.extName);
const { layout } = mail.data.context;
if (!layout) mail.data.context.layout = false;
this.viewEngine.renderView(templatePath, mail.data.context, function(err, body) {
if (err) return cb(err);
mail.data.html = body;
cb();
});
};
The text was updated successfully, but these errors were encountered:
Stacktrace:
at assertPath (path.js:28:11)
at Object.resolve (path.js:1171:7)
ExpressHandlebars._resolveLayoutPath
This issue is caused by the dependency:
ExpressHandlebars
.Underlying issue is because of a change in
ExpressHandlebars
, it will usedefaultLayout='main'
no matter what, as such it expects thelayoutDir
to be a string however for users who do not use a layout, like in my case, it will throw this error 'Path must be a string ...'Just putting this issue here so that people who might have this issue can know a quick fix:
Whenever you generate your
mailOptions
, set yourcontext.layout=false
.This would override the
defaultLayout
inExpressHandlebars
to be false and not produce this bug.The real fix would have to be implemented by
ExpressHandlebars
which there are requests to remove thedefaultLayout
.if a patch wants to be made in
nodemailer-express-handlebars
, I was thinking a quick fix could be adding the following to therender
function:The text was updated successfully, but these errors were encountered: