question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Serverless Application Repository Extra Layer Does not Contain Pydantic

See original GitHub issue

Expected 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:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
am29dcommented, Sep 19, 2022

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.

0reactions
github-actions[bot]commented, Sep 19, 2022

⚠️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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found