aws-powertools / powertools-lambda-python

A developer toolkit to implement Serverless best practices and increase developer velocity.
https://docs.powertools.aws.dev/lambda/python/latest/
MIT No Attribution
2.88k stars 397 forks source link

Bug: v2.40.0 undocumented breaking change in Router #4649

Closed inita-app closed 4 months ago

inita-app commented 4 months ago

Expected Behaviour

In out code we accessed current_event directly from Router class befor 2.40.0

Current Behaviour

In 2.40.0 version current_event available in AppSyncResolver only

Code snippet

from aws_lambda_powertools.event_handler import AppSyncResolver
from aws_lambda_powertools.event_handler.appsync import Router

user_router = Router()

@user_router.resolver(field_name="user")
def get_user() -> dict:
    return service.get_user_by_id(user_id=user_router.current_event.identity.sub)

app = AppSyncResolver()
app.include_router(user_router)

Possible Solution

No response

Steps to Reproduce

call current_event attribute from Router class

Powertools for AWS Lambda (Python) version

2.40.0

AWS Lambda function runtime

3.12

Packaging format used

Lambda Layers

Debugging logs

No response

boring-cyborg[bot] commented 4 months ago

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 Powertools for AWS Lambda Discord: Invite link

github-actions[bot] commented 4 months ago

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