JSReport on AWS Lambda with Phantom JS
-
Hi,
We are trying to use lambda for JSReport following https://jsreport.net/learn/aws-lambda-serverless
It works fine for Chromium but as of today, we have lot of reports with "phantom-pdf" recipe.After configuring it for phantom-pdf, we are getting error in lambda.
Phantom-pdf Configuration:
"phantom-pdf": { "strategy":"phantom-server", "numberOfWorkers": 1, "timeout": 180000, "allowLocalFilesAccess": false, "defaultPhantomjsVersion": "1.9.8" }
Error Message in lambda:
{ "errorType": "Error", "errorMessage": "phantom manager could not start all workers..", "trace": [ "Error: phantom manager could not start all workers..", " at /opt/nodejs/node_modules/phantom-workers/lib/phantomManager.js:65:47", " at /opt/nodejs/node_modules/phantom-workers/lib/phantomWorker.js:103:24", " at /opt/nodejs/node_modules/phantom-workers/lib/phantomWorker.js:128:20", " at Socket.<anonymous> (/opt/nodejs/node_modules/phantom-workers/lib/checkPortStatus.js:45:9)", " at Socket.emit (events.js:310:20)", " at TCP.<anonymous> (net.js:672:12)" ] }
Please suggest if there is a way to use Phatom-Pdf with lambda, if not, then suggest if it would work on Container.
-
phantomjs should work in aws lambda based on this post, you can try to follow the instructions.
I haven't tried it out myself, but it will be probably about replacing the binary for phantomjs, the same we do with chrome in our tutorial.
https://stackoverflow.com/questions/56795567/how-do-you-install-phantomjs-on-aws-lambda/56843029#56843029
-
But it may also fail because phantomjs for example doesn't work on the ubuntu bionic. It has some issues with a new version of OpenSSL, so there can be the same problem with the aws lambda os.
You additionally asked if it runs on Container. Not sure what container you mean, but if you ask about docker - yes, it works in docker. It is also still part of our official jsreport full image.
https://hub.docker.com/r/jsreport/jsreport/