Skip to content

getting errors installing or importing cryptography on AWS Lambda #11146

@wgn1993

Description

@wgn1993
  • Versions of Python, cryptography, cffi, pip, and setuptools you're using:
    Python 3.12 cffi-1.16.0 cryptography-42.0.8 pycparser-2.22 pip-24.1 setuptools-70.1.0
  • How you installed cryptography
    pip install cryptography
  • Clear steps for reproducing your bug
  1. install cryptography using pip, write test code
  2. test in dev local machine, it works without issue
  3. create the deployment package and upload it to AWS Lambda, getting error as below:
    {
    "errorMessage": "Unable to import module 'lambda_function': cannot import name 'x509' from 'cryptography.hazmat.bindings._rust' (unknown location)",
    "errorType": "Runtime.ImportModuleError",
    "requestId": "6f31441e-ba2b-4de8-af7c-eeb7f07d6bd5",
    "stackTrace": []
    }
    the lambda python runtime is 3.12, the same version as it on local machine

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting-on-reporterIssue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions