I'm trying to execute phantomjs using node-lambda and bits and pieces I found on the web mainly
https://github.com/justengland/phantom-lambda-template
I had some problems deploying node-lambda with node43 but manually installing the latest source seems to have helped in that regard.
but now I'm having trouble running the lambda functions. I get
2016-04-12T16:47:12.133Z 3330adb9-00ce-11e6-9c08-d79a6bc84748 Calling phantom: /var/task/phantomjs [ '/var/task/phantomjs-script.js' ]
2016-04-12T16:47:12.236Z 3330adb9-00ce-11e6-9c08-d79a6bc84748 Error: spawn EACCES
at exports._errnoException (util.js:870:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
Seems like lambda is not able to access the phantom binary.
Is there any way I can give the function more permission to do so?
Thanks
The reason for this problem might be that you deployed your locally built binaries to AWS Lambda. Lambda requires it's binaries to be compiled for Amazon Linux, otherwise it is not able to execute them (unless you are super lucky).
If you are calling any executables or using libraries that come with binaries you need to compile them on an EC2 machine with Amazon Linux and use the outcome in you Lambda function. This is a very basic tutorial.
If you already did that, also make sure the binary you are using are executable (you can do this by calling chmod 777 your_executable
). I guess you already did that (also phantomjs should take care of this in your case), but this is the main source of errors for EACCES.
This is a bit older, but I just solved a related problem and want to post the key piece here for posterity. In addition to what @birnbaum said about the binary needing to be compiled on an Amazon linux machine, you also need to bundle your deployable package (the zip file) on a linux machine! If you don't, the runtime will be able to find your binary, but not create an actual browser instance.