Can't get phantomjs to work on aws lambda

蹲街弑〆低调 提交于 2019-11-30 15:49:23

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!