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

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

Closed
lhendrick-t10 opened this issue Sep 15, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@lhendrick-t10
Copy link

lhendrick-t10 commented Sep 15, 2022

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

@lhendrick-t10 lhendrick-t10 added bug Something isn't working triage Pending triage from maintainers labels Sep 15, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 15, 2022

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link

@lhendrick-t10
Copy link
Author

Similar to this issue

@heitorlessa
Copy link
Contributor

@am29d could you help us on this?

@am29d
Copy link
Contributor

am29d commented Sep 19, 2022

Another mystery with the layers appears.

Due to recent revert of poetry.lock we have a version mismatch between the poetry configuration file and release tag. Our SAR pipeline assumes the version in this file is correct, which means equals to the git tag we use. So if we checkout the repo with specific tag, say v1.29.1 and run poetry build it should build a package for version 1.29.1, which is not the case at the moment (it creates a package for 1.26.6).

This caused dependency resolution issues during extras package installation:

Dependency walk failed at typing-extensions (>=3.7.4.3)

The biggest problem is that it failed silently and the tests did not catch the missing package in a test deployment. I will add additional mechanism with checks and tests to ensure it won't happen in the future.

I have checked the last 10 previous releases and only the last version is affected (1.29.1)

@rubenfonseca
Copy link
Contributor

@lhendrick-t10 thanks for reporting this! @am29d found and fixed the underlying issue, and we'll release 1.29.2 in the next hour to fix the SAR layer

@lhendrick-t10
Copy link
Author

Awesome! Thanks @am29d and @rubenfonseca, really appreciate all the help!

@am29d
Copy link
Contributor

am29d commented 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.

@am29d am29d closed this as completed Sep 19, 2022
@github-actions
Copy link
Contributor

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

@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants