Skip to content

Commit 2abc23c

Browse files
authored
fix(cli): requiresRefresh function does not respect null (#32666)
This function should also respect `expiration: null`, I think, but also I don't believe this fixes the ultimate issue of #32653. Just a guess at this point. The function docs are as follows: > @param requiresRefresh A function that will evaluate the resolved value and determine if it represents static value or one that will eventually need to be refreshed. For example, AWS credentials that have no defined expiration will never need to be refreshed, so this function would return true if the credentials resolved by the underlying provider had an expiration and false otherwise. Since we are respecting `null` as a valid `expiration` just like `undefined` in `credentialsAboutToExpire`, we should also respect it here. Underlying `memoize` function is this one: https://github.com/smithy-lang/smithy-typescript/blob/main/packages/property-provider/src/memoize.ts#L27 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 946b748 commit 2abc23c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/aws-cdk/lib/api/aws-auth/provider-caching.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export function makeCachingProvider(provider: AwsCredentialIdentityProvider): Aw
1515
return memoize(
1616
provider,
1717
credentialsAboutToExpire,
18-
(token) => token.expiration !== undefined);
18+
(token) => !!token.expiration,
19+
);
1920
}
2021

2122
export function credentialsAboutToExpire(token: AwsCredentialIdentity) {

0 commit comments

Comments
 (0)