fix(tracer): properly return DynamoDB.DocumentClient - #528
Conversation
|
Attaching an archive with a packed version of this branch ( |
flochaz
left a comment
There was a problem hiding this comment.
Could you add get or put calls in the e2e as well ?
|
Here at this link you can find a successful e2e test execution with the new changes. |
ijemmy
left a comment
There was a problem hiding this comment.
LGTM. Thanks for also updating the e2e tests.
| // This is needed because some aws-sdk clients like AWS.DynamoDB.DocumentDB don't comply with the same | ||
| // instrumentation contract like most base clients. | ||
| // For detailed explanation see: https://github.com/awslabs/aws-lambda-powertools-typescript/issues/524#issuecomment-1024493662 | ||
| this.provider.captureAWSClient((service as unknown as T & { service: T }).service); |
There was a problem hiding this comment.
Thanks for the detailed investigation!
There was a problem hiding this comment.
@dreamorosi question just for myself.
Why do we cast to unknown first and as T in the 2nd step?
There was a problem hiding this comment.
You are right, it's a leftover from a previous experiment and it's not needed since T is already a generic. Fixed in latest commit.
Description of your changes
This PR aims at fixing the bug identified in #524.
How to verify this change
Check GitHub actions execution results, the unit tests now include test cases to assert on the type of client being returned.
Related issues, RFCs
#524
PR status
Is this ready for review?: YES
Is it a breaking change?: NO
Checklist
Breaking change checklist
N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.