Permissions trouble on AWS Lambda, can’t spawn child process


So I’ve created this nice little lambda, which runs great locally, however not so much when actually out in the wild.

The lambda takes an event, with html in the event source, converts that html to a PDF (using the html-pdf node module), passes that pdf to an s3 bucket, and then hands back a signed url that expires in 60 seconds.

Or at least that is what ought to happen (again, works locally). When testing on Lambda, I get the following error:

Here’s the code itself (not compiled, there’s a handy gulp task for that)

Seems like a problem within html-pdf. I thought it might be a problem with PhantomJS (which html-pdf depends on) due to some reading I did here: , however, since Lambda has bumped the max zip size to 50mb, I don’t have a problem uploading the binary.

Any thoughts?


html-pdf uses phantomjs under the hood, which needs to compile some binaries when being installed. I guess your problem is that you are deploying those locally compiled binaries but Lambda needs the binaries compiled on Amazon Linux.

You can solve this problem by building your deploy package on an EC2 instance that is running Amazon Linux and then e.g. directly deploy it from there like it is explained in this tutorial.

Also check out this answer on a similar problem.

Leave a Reply