aws-sdk-js
aws-sdk-js copied to clipboard
Credentials expiryWindow declared as static class field in types, but is actually implemented as a public instance field
- [x] I've gone through Developer Guide and API reference
- [x] I've checked AWS Forums and StackOverflow for answers
- [x] I've searched for previous similar issues and didn't find any solution
- [x] This is an issue with version 2.x of the SDK
Describe the bug
Setting the static class field expiryWindow of the Credentials class as per the type declaration:
https://github.com/aws/aws-sdk-js/blob/master/lib/credentials.d.ts#L62
has no effect on instances of this class due to the fact the class implementation has the expiryWindow defined as a public instance field:
https://github.com/aws/aws-sdk-js/blob/master/lib/credentials.js#L88
Is the issue in the browser/Node.js? Node.js
If on Node.js, are you running this on AWS Lambda? No
Details of the Node.js version v16.13.1
SDK version number v2.1125.0
To Reproduce (observed behavior)
// set static class value to 15 minutes (as per the class type definition)
AWS.Credentials.expiryWindow = 15 * 60;
const credentials = new AWS.Credentials('key', 'secret', 'token');
// this fails as the public instance field defaults to 15 (as per the class implementation)
expect(credentials.expiryWindow).to.equal(900);
Expected behavior The expect call above should succeed.
Screenshots N/A
Additional context Reference on class terminology: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields
I would Like to take up this issue. Please assign it to me.
@vectronic thanks for opening this issue, from looking at it I believe it should not be marked Static.
I have investigated the bug. Should i propose a pr related to the bug?