Closed
Description
Static type checker used
pyright/pylance
AWS Lambda function runtime
3.11
Powertools for AWS Lambda (Python) version
3.6.0
Static type checker info
Argument missing for parameter "context"
The issue only happens when there is any parameter set in capture_lambda_handler
.
Code snippet
@logger.inject_lambda_context(log_event=True)
@tracer.capture_lambda_handler(capture_response=False)
def handle(event, context: LambdaContext) -> dict:
return app.resolve(event, context)
Possible Solution
Metadata
Metadata
Assignees
Type
Projects
Status
Shipped
Activity
boring-cyborg commentedon Feb 28, 2025
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 commentedon Feb 28, 2025
Oi @tiagohconte, tudo bem?!
We are missing the return type annotation in the
capture_lambda_handler
decorator, that's why pyright is complaining and mypy will complain too. Although we don't fully support strict typing in Powertools, I see we might fix this. Do you want to submit a PR to fix it? I think annotating the return type with a Callable with Event and Context should solve the problem.Obrigado!
tiagohconte commentedon Mar 1, 2025
Oi @leandrodamascena, tudo bem e contigo?
Thanks for the quick response! Just opened a PR to solve the issue 😃
github-actions commentedon Mar 3, 2025
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.