BotocoreDependencyFix (Resolves Lambda & AWS X-Ray Demo import error) #160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolved package dependency errors with botocore that resulted in 502 Bad Gateway errors from Lambda invocation; repackaged function.zip file now functions as expected, while the prior version fails due to version dependency issues.
Demo currently fails due to this import error:
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': cannot import name 'DEPRECATED_SERVICE_NAMES' from 'botocore.docs' (/var/task/botocore/docs/__init__.py)
Demo video URL: https://learn.cantrill.io/courses/1101194/lectures/46260482
Tested the modified function.zip version and it works, but it is best to replicate this solution yourself for security reasons rather than approving and merging this pull request.
Detailed Resolution Steps to replicate solution:
1) Set Up a Virtual Environment:
2) Install Dependencies:
3) Package the Dependencies:
4) Add the Lambda Function Code:
5) Upload the ZIP to Lambda:
6) Verification:
Test the Lambda Function:
Invoke the Lambda function and check if the botocore import error persists.
Monitor CloudWatch logs for any new errors.