My script is failing when attempting to load the template, with the following error:
FATAL ERROR: JS Allocation failed - process out of memory exited with code 5
The code that I'm calling looks like this:
emailTemplates(templatesDir, function(err, template) {
winston.info("Setting up templates.", templatesDir);
if(err) {
winston.error(err);
}else{
var today = new Date().getDay();
winston.info("Found that today is ", aDays[today]);
template("notify", {
reports: [{
item: "merged",
desc: "Blah blah"
},{
item: "searched",
desc: "Blah blah"
}],
vars: Operators.BBT.mail,
day: aDays[today],
fusionAPIRan: canRunFAPI
}, function(err, html, text) {
if(err) {
winston.error(err);
}else{
winston.info("Attempting to send an email!");
smtpTransport.sendMail({
from: "Webmaster <webmaster@example.co.uk>",
to: "james@example.co.uk",
subject: "Worker - Notification Email",
html: html
}, function(error, response){
if(error){
winston.error(error);
cb(false);
}else{
winston.info("Message sent: " + response.message + ", message id: " + response.messageId);
cb(true);
}
});
}
});
}
});
It gets as far as Found that today is xxx
and the winston.error
inside doesn't get called. What's causing that? A dodgy template perhaps?