From 1c53896afcf0820d2cca196ede587cb64c8b679f Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 27 Dec 2024 13:57:36 +0100 Subject: [PATCH] fix(cli): CLI still fails for some plugins returning `expiration: null` There is one more location where we need to convert `null` into `undefined` if a plugin provider returns `expiration: null`. The SDKv3 code base also expects this value to be `undefined | Date`, just like our own code does; when the plugin returns `null` we pass the value over to the SDKv3 which then does a `getTime()` on the value, and then it crashes. Issue this fix as a patch, so that we can unblock users of a commonly used plugin at Amazon. --- packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts index b2047bd3fbbfb..8737f1eed2096 100644 --- a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts +++ b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts @@ -140,7 +140,7 @@ function v3ProviderFromV2Credentials(x: SDKv2CompatibleCredentials): AwsCredenti accessKeyId: x.accessKeyId, secretAccessKey: x.secretAccessKey, sessionToken: x.sessionToken, - expiration: x.expireTime, + expiration: x.expireTime ?? undefined, }; }; }