EPIPE issue on html-pdf nodejs

69 Views Asked by At
   new Promise((resolve, reject) => {
        this.fileName = this.pdf.toFile(saveLocation, (err, data) => {
            if (err) {
                reject(err);
            }
            resolve(this);
        });
    });

In this.pdf.toFile i'm facing issue:

write EPIPE
{
......."title": "Uncaught Exception",
......."name": "Error",
......."message": "write EPIPE",

Even though the file size is not large.

I've tried multiple solutions :

pdf.create(html, {
  phantomPath: path.resolve(
    process.cwd(),
    "node_modules/phantomjs-prebuilt/bin/phantomjs"
  ),
})

sudo apt-get install libfontconfig1

npm rebuild phantomjs-prebuilt

Tried reinstalling the packages as well.

but none of the solutions seem to be working. It's working on test environment with same configuration as that of prod. But on prod it doesn't work which is on pm2 and tried switching on docker as well but no success.

It is hosted on EC2 instance OS: Ubuntu 22.04 Node: 13.14

0

There are 0 best solutions below