Skip to content

Fast API run script Excludes LAMBDA_RUNTIME_DIR from Search Path #453

Closed
@renjiexu-amzn

Description

@renjiexu-amzn

e.g., https://github.com/awslabs/aws-lambda-web-adapter/blob/main/examples/fastapi-response-streaming-zip/app/run.sh#L4 is setting PYTHONPATH to LAMBDA_TASK_ROOT, which led to the search path (more background in Working with .zip file archives for Python Lambda functions) becoming ['', '/var/task', '/var/task', '/var/lang/lib/python38.zip', '/var/lang/lib/python3.8', '/var/lang/lib/python3.8/lib-dynload', '/var/lang/lib/python3.8/site-packages']. The second and third element are duplicate. And even worse, $LAMBDA_RUNTIME_DIR isn't in the search path any more, which led to the user won't be able to use the bundled modules under $LAMBDA_RUNTIME_DIR (e.g., boto3 SDK, which a user may not bundle into their zip archive to stay under the unzipped size limit).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions