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: v2.40.0 undocumented breaking change in Router #4650

Closed
karvetskiy opened this issue Jun 28, 2024 · 10 comments
Closed

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

karvetskiy opened this issue Jun 28, 2024 · 10 comments
Assignees
Labels
bug Something isn't working event_handlers

Comments

@karvetskiy
Copy link

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

@karvetskiy karvetskiy added bug Something isn't working triage Pending triage from maintainers labels Jun 28, 2024
Copy link

boring-cyborg bot commented Jun 28, 2024

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

@leandrodamascena
Copy link
Contributor

Checking now.

@leandrodamascena leandrodamascena self-assigned this Jun 28, 2024
@leandrodamascena leandrodamascena removed the triage Pending triage from maintainers label Jun 28, 2024
@leandrodamascena
Copy link
Contributor

Hi @karvetskiy, thanks for opening this issue and reporting this bug. Our tests didn't catch accessing current_event using the Router object directly and because of this we have this breaking change in this release, sorry about that. I'm working to fix and will release a new version in a few minutes.

Thanks

@leandrodamascena
Copy link
Contributor

leandrodamascena commented Jun 28, 2024

Hey @karvetskiy! If I publish a pre-release on Pypi, can you test if the issue is resolved in your environment before we release a new patch release? Thanks

@karvetskiy
Copy link
Author

Hey @leandrodamascena! Just checked alpha version, still can't access current_event.
Looks like new Router class in event_handler.graphql_appsync.router inhered from wrong implementation of BaseRouter class.
It has different implementation in v2.39.1 (see code)

@heitorlessa
Copy link
Contributor

he hasn't published yet, will ping you shortly @karvetskiy

@heitorlessa
Copy link
Contributor

PR incoming, we've been wrestling with static typing and additional tests to be quadruple sure this would work on areas we were missing tests too.

Once we merge and publish the alpha release we ping you

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Jun 28, 2024
@heitorlessa
Copy link
Contributor

heitorlessa commented Jun 28, 2024

kicked off pre-release (should be in PyPi in ~6 minutes or so).. https://github.com/aws-powertools/powertools-lambda-python/actions/runs/9712027684

@leandrodamascena
Copy link
Contributor

Hey @karvetskiy! alpha release is available. Can you test pls?

https://pypi.org/project/aws-lambda-powertools/2.40.1a1/

Copy link
Contributor

This is now released under 2.40.1 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working event_handlers
Projects
Status: Coming soon
Development

No branches or pull requests

3 participants