Add region param to the getDefaultCredentialsChain

Signed-off-by: KaemonIsland <kaemonlovendahl@outlook.com>
This commit is contained in:
KaemonIsland
2024-10-07 16:57:21 -04:00
parent bd819ca533
commit 9457319d26
@@ -77,8 +77,15 @@ function getProfileCredentials(
});
}
function getDefaultCredentialsChain(): AwsCredentialIdentityProvider {
return fromNodeProviderChain();
/**
* Include the region if present, otherwise use the default region
*
* @see https://www.npmjs.com/package/@aws-sdk/credential-provider-node
*/
function getDefaultCredentialsChain(
region = 'us-east-1',
): AwsCredentialIdentityProvider {
return fromNodeProviderChain({ clientConfig: { region } });
}
/**
@@ -123,7 +130,7 @@ function getSdkCredentialProvider(
return getProfileCredentials(config.profile!, config.region);
}
return getDefaultCredentialsChain();
return getDefaultCredentialsChain(config.region);
}
/**
@@ -145,7 +152,7 @@ function getMainAccountSdkCredentialProvider(
return getProfileCredentials(config.profile!, config.region);
}
return getDefaultCredentialsChain();
return getDefaultCredentialsChain(config.region);
}
/**