Getting errors using this package in AWS Lambda Nodejs 10.x and up
See original GitHub issueI’ve been using this package for ages and worked like a charm on AWS Lambda with Nodejs 8.10 and older.
But AWS now forces you to use 10.x and later…
When I updated my version I started getting the following errors from the lambda execution stack:
ERROR Uncaught Exception
{
"errorType": "Error",
"errorMessage": "write EPIPE",
"code": "EPIPE",
"errno": "EPIPE",
"syscall": "write",
"stack": [
"Error: write EPIPE",
" at WriteWrap.afterWrite [as oncomplete] (net.js:789:14)"
]
}
It also throws this error just before the above error:
Error: html-pdf: Received the exit code '127'
/var/task/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
at ChildProcess.respond (/var/task/node_modules/html-pdf/lib/pdf.js:121:31)
at ChildProcess.emit (events.js:198:13)
at ChildProcess.EventEmitter.emit (domain.js:448:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
I have tried setting the phantomPath
option, still did not help.
Any help will be greatly appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:24
Top Results From Across the Web
AWS Lambda function errors in Node.js
This page describes how to view Lambda function invocation errors for the Node.js runtime using the Lambda console and the AWS CLI.
Read more >NPM package `pem` doesn't seem to work in AWS lambda ...
I tried the answer documented by @Kris White, but I was not able to get it to work. Each execution resulted in the...
Read more >Upgrading to Serverless Framework v3
The default Lambda runtime has changed from NodeJS 12 to NodeJS 14, given this is now the default runtime recommended by AWS. Additionally,...
Read more >Reviewing the AWS Lambda nodejs10.x runtime - Michael Hart
As with the other runtimes, it patches the native console.(log|error|warn|info) functions to prepend tab-separated metadata to each call (not a huge fan of ......
Read more >Cannot find module (AWS Lambda Error) [Solved] | bobbyhadz
A complete step-by-step guide on how to solve the "Cannot find module" error when trying to load third party packages in AWS lambda....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Two other resources got this fixed for me on Node 10:
For more context and a guide if you want to compile everything yourself: https://stackoverflow.com/questions/56795567/how-do-you-install-phantomjs-on-aws-lambda
Or get the output in this repo: https://github.com/naeemshaikh27/phantom-lambda-fontconfig-pack
As a minimum to get it working:
NOTE: LD_LIBRARY_PATH was not required for it to work
I am also facing the same issue on Microsoft azure app server “error”: { “status”: 500, “message”: “html-pdf: Received the exit code ‘127’\n/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory\n” }