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: Invalid type for ApiGatewayAuthorizerRequestV2 parser model #5879

Closed
leandrodamascena opened this issue Jan 17, 2025 · 4 comments · Fixed by #5880
Closed

Bug: Invalid type for ApiGatewayAuthorizerRequestV2 parser model #5879

leandrodamascena opened this issue Jan 17, 2025 · 4 comments · Fixed by #5880
Assignees
Labels
bug Something isn't working parser Parser (Pydantic) utility

Comments

@leandrodamascena
Copy link
Contributor

Expected Behaviour

Original issue: aws-powertools/powertools-lambda-typescript#3483

The identitySource field in ApiGatewayAuthorizerRequestV2 can be None when the Lambda authorizer is not configured with an identity source.

Current Behaviour

Its always considering a List with at least 1 record, but can be None.

Code snippet

import json
from aws_lambda_powertools.utilities.parser import parse
from aws_lambda_powertools.utilities.parser.models import ApiGatewayAuthorizerRequestV2

def lambda_handler(event, context):
    parsed_event = parse(model=ApiGatewayAuthorizerRequestV2, event=event)
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }

Possible Solution

Add Optional.

Steps to Reproduce

1 - Deploy the code below
2 - Invoke the Lambda with a valid payload from API GW HTTP Authorizer v2

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.13

Packaging format used

Lambda Layers, Serverless Application Repository (SAR) App, PyPi

Debugging logs

@leandrodamascena
Copy link
Contributor Author

@anafalcao can you please fix this?

@anafalcao
Copy link
Collaborator

Hey @leandrodamascena ! Sure, I'll work on it

@dreamorosi dreamorosi removed the triage Pending triage from maintainers label Jan 17, 2025
@dreamorosi dreamorosi moved this from Triage to Working on it in Powertools for AWS Lambda (Python) Jan 17, 2025
@anafalcao anafalcao added the parser Parser (Pydantic) utility label Jan 17, 2025
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Jan 17, 2025
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.

Copy link
Contributor

This is now released under 3.5.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser Parser (Pydantic) utility
Projects
Status: Shipped
3 participants