Bug: @tracer.captureMethod() is not bound to the decorated class #1028
Closed
Description
Bug description
The @tracer.captureMethod() decorator is bound to the decorator not the class its decorating.
export class Lambda implements LambdaInterface {
@tracer.captureMethod()
myMethod(){
//other method is undefined as "this" is no longer the Lambda class
this.otherMethod()
}
otherMethod(){}
}
Expected Behavior
this.otherMethod()
should call the this.otherMethod()
in the same class
Current Behavior
this.otherMethod()
is undefined
Possible Solution
see #1026
the @tracer.captureLambdaHandler()
decorator already does this
Steps to Reproduce
- create a class with two or methods in it
- add the decorator
@tracer.captureMethod()
to one or more of the function - call another method or prop in the decorated method
- the method or prop will be undefined
Environment
- Powertools version used: 1.0.2
- Packaging format (Layers, npm):
- AWS Lambda function runtime:
- Debugging logs:
Activity