0

We need to do file transfer from AWS lambda to remote machine. We are using fabric for this. Till last week, AWS lambda is working fine. Today we created new zip file and uploaded to AWS lambda and it is throwing below error.

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /var/task/cryptography/hazmat/bindings/_rust.abi3.so)

But if we upload old zip file (last week zip file) to AWS lambda, it is working fine. Not sure why this is happening as we haven't done any changes.

The only difference I observed with both zip files is old zip file contains 'pip-20.1.1.dist-info' and new zip file contains 'pip-22.0.4.dist-info'.

I went through lot of stack overflow questions and did some research online as below.

Above links are suggesting that

cryptography>=35.0, plus pip>=20.3 - downloads wrong cryptography anywheel package (GLIBC_2.18 error) #1063

and suggesting to downgrade cryptography to 3.4.8 to fix the issue. I downgraded as suggested but it didn't fix the issue.

I also downgraded pip version. Now new zip file also contains same 'pip-20.1.1.dist-info' but still I am facing the same issue with the new zip file.

More details :

I am using virtualenv. My requirements.txt only contains one line fabric==2.7.1. I am installing the packages locally on aws ec2 instance under virtualenv using pip install -r requirements.txt.

Can anyone please let me know how to fix the issue.

kadina
  • 5,042
  • 4
  • 42
  • 83

1 Answers1

0

It looks mostly like a deployment issue. Either of the two:

  1. Bundling the libraries is not right, and they are not found in the function. To verify that you can get to the function in the AWS console, and export it as a zip file. See if all needed packages are in the zip.
  2. The package isn't compiled with the right architecture. Some Python libraries are being compiled specifically on the host on which they are being installed (including some that you've mentioned). So if the deployment runs from a macOS, for example, it wouldn't work on a Lambda function. To fix that - either run the deployment from a Linux machine, or if you're using serverless, you can use the serverless-python-requirements.
  • Thank you. But I am using the same deployment method as I was using previously. I haven't added any additional code. So the same libraries which are working previously are needed. In fact I verified both zip files (old and new) and all packages are same and number of packages are same in both zip files except version of pip-dist-info version as mentioned in the question. I t is very strange. – kadina Dec 12 '22 at 13:20
  • More details : I am using virtualenv. My requirements.txt only contains one line fabric==2.7.1. I am installing the packages locally under virtualenv using 'pip install -r requirements.txt' and I am using aws ec2 instance. – kadina Dec 12 '22 at 14:07
  • Got it. It sounds weird to me - I would consider reviewing both zip files thoroughly to see what the difference is (maybe a package version, maybe a different package architecture support). That would give you a clue what changed (except for your own code) – Ran Ribenzaft Dec 14 '22 at 09:45