From 7ceaf96edc86cc1713cef59eba79feeb23f59da1 Mon Sep 17 00:00:00 2001 From: Michael Lehmann Date: Thu, 29 Jan 2026 10:47:17 -0800 Subject: [PATCH] fix: correct outputs for role chaining (#1633) re-instantiate stsClient when roleChaining technically a breaking change --- dist/index.js | 8 ++++++-- src/CredentialsClient.ts | 5 ++++- src/index.ts | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index a978259..879da45 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36,9 +36,10 @@ class CredentialsClient { httpAgent: handler, }); } + this.roleChaining = props.roleChaining; } get stsClient() { - if (!this._stsClient) { + if (!this._stsClient || this.roleChaining) { const config = { customUserAgent: USER_AGENT }; if (this.region !== undefined) config.region = this.region; @@ -756,7 +757,10 @@ async function run() { } (0, helpers_1.exportRegion)(region, outputEnvCredentials); // Instantiate credentials client - const clientProps = { region }; + const clientProps = { + region, + roleChaining, + }; if (proxyServer) clientProps.proxyServer = proxyServer; if (noProxy) diff --git a/src/CredentialsClient.ts b/src/CredentialsClient.ts index f05b2b5..2d78b49 100644 --- a/src/CredentialsClient.ts +++ b/src/CredentialsClient.ts @@ -12,12 +12,14 @@ export interface CredentialsClientProps { region?: string; proxyServer?: string; noProxy?: string; + roleChaining: boolean; } export class CredentialsClient { public region?: string; private _stsClient?: STSClient; private readonly requestHandler?: NodeHttpHandler; + private roleChaining?: boolean; constructor(props: CredentialsClientProps) { if (props.region !== undefined) { @@ -39,10 +41,11 @@ export class CredentialsClient { httpAgent: handler, }); } + this.roleChaining = props.roleChaining; } public get stsClient(): STSClient { - if (!this._stsClient) { + if (!this._stsClient || this.roleChaining) { const config = { customUserAgent: USER_AGENT } as { customUserAgent: string; region?: string; diff --git a/src/index.ts b/src/index.ts index 831d691..541352c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -121,7 +121,10 @@ export async function run() { exportRegion(region, outputEnvCredentials); // Instantiate credentials client - const clientProps: { region: string; proxyServer?: string; noProxy?: string } = { region }; + const clientProps: { region: string; proxyServer?: string; noProxy?: string; roleChaining: boolean } = { + region, + roleChaining, + }; if (proxyServer) clientProps.proxyServer = proxyServer; if (noProxy) clientProps.noProxy = noProxy; const credentialsClient = new CredentialsClient(clientProps);