i am trying to create a pdf and storing it from an HTML template stored in S3 using html-pdf module. I get this exception when try to lunch pdF.create
Error: write EPIPE
at exports._errnoException (util.js:1018:11)
at WriteWrap.afterWrite (net.js:800:14)
Here below there is my pdf.create function
pdf.create(templateHtml, options).toStream(function (err, stream) {
console.log("stream :" + stream);
if (err) {
console.log('pdf err : ', err);
} else {
var stream = stream.pipe(fs.createWriteStream(filename));
stream.on('finish', function () {
let params_out = {
Bucket : "partecipants-report",
Key : "template_upload.html",
Body : fs.createReadStream(filename),
ContentType : "application/pdf"
};
s3.putObject(params_out, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else{
console.log("upload ended :" + data);
context.succeed("upload ended");
}
});
});
}
});
Could please help me understand how to solve it?
Many thanks