-
Notifications
You must be signed in to change notification settings - Fork 429
Bug: @metrics.log_metrics
decorator does not accept additional arguments passed to wrapped function
#3119
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
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
@thegeorgeliu merged 🎉 Let us know if this can't wait until tomorrow for a bug fix release. Thank you for your first contribution and huge thanks for making both bug report and PR so easy to review ;) |
Thanks @heitorlessa! No worries, there's no issues with waiting till tomorrow. Glad the PR made the cutoff for the release! |
Great!! FYI - for bugs that have no workaround and block multiple customers, we make a bug fix straightaway (typically ~30m after merge). Hence the ask ;) Will ping back upon release. Have a great evening |
Closing as complete #3119 |
|
Expected Behaviour
The function wrapped by
@metrics.log_metrics
decorator (e.g. lambda handler) should be able to accept arguments other than the event and lambda context.Current Behaviour
If an additional positional argument is passed to the wrapped function, the following error is encountered:
TypeError: lambda_handler() takes 2 positional arguments but 3 were given
If an additional keyword argument is passed, this error is raised:
TypeError: lambda_handler() got an unexpected keyword argument 'additional_arg_name'
Code snippet
Possible Solution
The
decorate()
function forlog_metrics
should take in*args
and**kwargs
as arguments and then pass them to thelambda_handler()
call.A similar issue with the
@logger.inject_lambda_context
decorator was fixed in #1276Steps to Reproduce
This can be consistently reproduced using the code snippet above.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.10
Packaging format used
PyPi
Debugging logs
No response
The text was updated successfully, but these errors were encountered: