I have been using html-pdf (phantomjs) for creating PDF on AWS Lambda with NodeJS 8.0 and it was working fine. Since AWS Lambda has stopped support on NodeJS 8.0 we have updated our NodeJS version to the latest 12.x and we are now getting the following error when we run out PDF Lambda function:
{"errorType":"Error","errorMessage":"write EPIPE","code":"EPIPE","errno":"EPIPE","syscall":"write","stack":["Error: write EPIPE"," at afterWriteDispatched (internal/stream_base_commons.js:154:25)"," at writeGeneric (internal/stream_base_commons.js:145:3)"," at Socket._writeGeneric (net.js:784:11)"," at Socket._write (net.js:796:8)"," at doWrite (_stream_writable.js:403:12)"," at writeOrBuffer (_stream_writable.js:387:5)"," at Socket.Writable.write (_stream_writable.js:318:11)"," at PDF.PdfExec [as exec] (/var/task/node_modules/html-pdf/lib/pdf.js:141:15)"," at PDF.PdfToBuffer [as toBuffer] (/var/task/node_modules/html-pdf/lib/pdf.js:44:8)"," at /var/task/index.js:121:38"]}
phantomPath: './phantomjs_lambda/phantomjs'
process.env.FONTCONFIG_PATH='/var/task/fonts'
I tried to check similar issues in StackOverflow. I have pointed the phantomjs path correctly, also have the fontconfig in place. We are now stuck as we are unable to update the Lambda function. Any help will be highly appreciated.
Update: Changed the path to phantomjs binary:
phantomPath: './node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs'
After changing the path to phantomjs binary, the error has changed to:
{"errorType":"Error","errorMessage":"write EPIPE","code":"EPIPE","errno":"EPIPE","syscall":"write","stack":["Error: write EPIPE"," at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)"]}