Bug: Serverless Application Repository Extra Layer Does not Contain Pydantic
See original GitHub issueExpected Behaviour
Attaching the extras layer to a Lambda Function should enable it to use pydantic functionality for the Parser.
Current Behaviour
Attempting to invoke the Lambda returns the following error:
{
"errorMessage": "Unable to import module 'lambda_function': No module named 'pydantic'",
"errorType": "Runtime.ImportModuleError",
"requestId": "be591aa8-0c3b-477c-ac86-bc13d602cf5a",
"stackTrace": []
}
Downloading the layer provides me with a 10.1 MB zip file, where the docs say to expect a 22MB compressed file
Attached Code Snippet is a minimal example
Code snippet
from aws_lambda_powertools.utilities.parser import event_parser, BaseModel, envelopes
class TestClass(BaseModel):
some: str
data: str
item: str
@event_parser(model=TestClass, envelope=envelopes.EventBridgeEnvelope)
def lambda_handler(event: TestClass, context):
print(event.some)
Possible Solution
Rebuild and deploy layer with pydantic dependencies
Steps to Reproduce
- Deploy SAR “extras” layer into Account
- ARN: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-extras
- Attach to a Lambda Function that attempts to use the event parser
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
Serverless Application Repository (SAR) App
Debugging logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Changelog - Lambda Powertools Python - Open Source at AWS
This project follows Keep a Changelog format for changes and adheres to Semantic ... All: Official Lambda Layer via Serverless Application Repository ......
Read more >Python Requirements - Serverless Framework: Plugins
Another method for dealing with large dependencies is to put them into a Lambda Layer. Simply add the layer option to the configuration....
Read more >Deploying Python Flask microservices to AWS using open ...
The application will be hosted on an Amazon ECS cluster running on ... if not artist or not song: return jsonify({'error': 'Please provide...
Read more >Building Python Web APIs with FastAPI
His background has led him to build command-line applications, ... or access the code from the book's GitHub repository (a link is available...
Read more >AWS Lambda Input Validation Best Practices - Ran The Builder
I'll provide a working, open-source AWS Lambda handler template Python project. This handler embodies Serverless best practices and has all the bells and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @lhendrick-t10 , sorry for the release delay, but the new version 1.29.2 is now deployed to SAR and the issue has been fixed.
⚠️COMMENT VISIBILITY WARNING⚠️
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.