title: Lambda Not Loading Cryptography Shared Library
body: <p>I'm using the cryptography library in AWS Lambda. I've compiled the package using pip in an Amazon Linux VM. I have uploaded the package as a layer. Either way, every time I call the library, I have an error which is not descriptive at all:</p>
  <pre><code>Unable to import module 'lambda_function': libffi-ae16d830.so.6.0.4: cannot open shared object file: No such file or directory
  </code></pre>
  <p>As you can see, the error is not about not finding the lib, is another shared module which I haven't been able to find.</p>
  <p>Here's an example of the code I'm trying to execute on Lambda:</p>
  <pre><code>from cryptography.hazmat.backends import default_backend
  from cryptography.hazmat.primitives import hashes
  from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
  from cryptography.fernet import Fernet
  
  password_provided = &quot;test123&quot; 
  password = password_provided.encode() 
  salt = b'test_' 
  kdf = PBKDF2HMAC(
      algorithm=hashes.SHA256(),
      length=32,
      salt=salt,
      iterations=100000,
      backend=default_backend()
  )
  key = base64.urlsafe_b64encode(kdf.derive(password)) 
  
  
  message = &quot;message from db&quot;.encode()
  
  f = Fernet(key)
  encrypted = f.encrypt(message)
  
  print(encrypted)
  
  f = Fernet(key)
  decrypted = f.decrypt(encrypted)
  
  print(decrypted.decode(&quot;utf-8&quot;))
  </code></pre>
  <p>It's not the first time I've compiled a library to work on AWS Lambda, but in this case even I compile the cryptography lib. What should I add or change?</p>
  <p><strong>Edit:</strong>
  I've found out the library was missing in the zip file I've created, as is inside a hidden folder. I zipped using '.' instead of '*'  but now I'm running with a new problem: When I run the lambda, I get this:</p>
  <pre><code>Unable to import module 'lambda_function': /opt/cryptography/hazmat/bindings/_constant_time.so: undefined symbol: PyInt_FromLong
  </code></pre>
  <p>any idea?</p>