lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lambci/lambda:build-ruby2.7 has libcurl library, but AWS does not

opened this issue · comments

This may be just one library. I mostly blame Amazon for this, because why the heck would they not include libcurl in the standard Ruby 2.7 lambda image?

Nonetheless, I kept getting esoteric exceptions raised by FFI being unable to load libcurl.

My solution was to copy the following files from your image into /var/task/lib, one at a time, until the deploy worked:

libcurl.so.4
libidn2.so.0
liblber-2.4.so.2
libldap-2.4.so.2
libnghttp2.so.14
libnss3.so
libsasl2.so.3
libsmime3.so
libssh2.so.1
libssl3.so
libunistring.so.0

Upside to the files being in your image: it was fairly trivial to copy the files from your image into my /var/task/lib folder using docker run -it ... bash once I knew where they would work, as they are compatible with AWS' version of Linux:

  1. Deploy to AWS.
  2. Invoke the function.
  3. Read the error message.
  4. Copy the missing library file.
  5. Rinse. Repeat.

However, the downside is that the image does not really mirror AWS. I would really like to know if a library is missing from AWS before having to deploy it.

Would be nice if the essential libraries such as libcurl that Amazon so very kindly left out of their Lambda deploy stack would also be missing from the Docker image. :)

The build images specifically don't mirror AWS – the normal run images do (eg, lambci/lambda:ruby2.7)

The build images have a whole bunch of extra stuff to help you build native modules, etc – this is all documented in the README.

Glad you sorted it out in the end!

🤦 Thanks! Legally blind developer here... so much documentation to pile through for these things. I will try the runtime image next time.