Server-less functions like AWS Lambda are growing in popularity and it would be peachy if it were easier to install nodegit for use in this environment. To prepare & build a lambda handler able to work with git repos in nodejs it requires a container/virtualization [or running remotely on AWS EC2], a variety of package dependencies, and a considerable chunk of time (~15 min on a 2015 MBP) to compile nodegit from source to circumvent the libcurl-gnutls.so.4 issue others have already highlighted as a blocker in other unsupported distributions (e.g. #1361):
throw ex; ^ Error: libcurl-gnutls.so.4: cannot open shared object file: No such file or directory
As you begin to use nodegit in an enterprise environment, you want to create a repeatable build and CI pipeline, and ideally for that process it would be easier and less time-consuming to prepare a lambda handler zip with nodegit.
Steps required to use the nodegit package in a Node.JS 6.10 runtime based function in AWS Lambda:
1) Launch an EC2 instance or virtual/container based on the AWS Lambda execution environment (https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html):
docker run -it --rm -vpwd
:/lambda amazonlinux:2017.03 sh
2) From that environment, add a package repo for the same version of nodejs:
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
3) Install nodejs and other packages required to install nodegit:
yum -y install nodejs net-tools gcc-c++ diffutils file openssl-devel libcurl-devel
4) Rebuild nodegit from source:
cd /lambda && BUILD_ONLY=1 npm install nodegit
Thanks for any optimization/simplification!