aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

Credentials expiryWindow declared as static class field in types, but is actually implemented as a public instance field

Open vectronic opened this issue 3 years ago • 3 comments

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

vectronic avatar May 12 '22 13:05 vectronic

I would Like to take up this issue. Please assign it to me.

KirtanSoni avatar May 25 '22 07:05 KirtanSoni

@vectronic thanks for opening this issue, from looking at it I believe it should not be marked Static.

ajredniwja avatar May 31 '22 13:05 ajredniwja

I have investigated the bug. Should i propose a pr related to the bug?

KirtanSoni avatar May 31 '22 15:05 KirtanSoni