Skip to content

Bug: Serverless Application Repository Extra Layer Does not Contain Pydantic #1519

Closed
@lhendrick-t10

Description

@lhendrick-t10

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions