Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast API run script Excludes LAMBDA_RUNTIME_DIR from Search Path #453

Closed
renjiexu-amzn opened this issue Apr 26, 2024 · 1 comment
Closed

Comments

@renjiexu-amzn
Copy link
Contributor

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).

@bnusunny
Copy link
Contributor

Thanks for reporting this issue. This affects python runtimes below 3.11. From 3.11 and above versions, AWS SDK is installed in /var/lang/lib/python3.x/site-packages.

renjiexu-amzn added a commit to renjiexu-amzn/aws-lambda-web-adapter that referenced this issue Apr 26, 2024
…DA_RUNTIME_DIR in search path and fix the order in PYTHONPATH.
bnusunny pushed a commit that referenced this issue Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants