Skip to content

callerClientConfig not passed to credentials provider when configured through extensions #6953

@arnellebalane

Description

@arnellebalane

Checkboxes for prior research

Describe the bug

We're implementing a new credentials provider, and in its implementation we are using callerClientConfig which gets passed to it to determine the client's region and logger function. We're also providing an SDK extension which calls the credentials provider under the hood.

When the credentials provider is used in any SDK client through the credentials parameter, our credentials provider function receives the callerClientConfig parameter correctly.

However when we use it through the extensions parameter, the credentials provider function does not receive any parameters.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v18.20.5

Reproduction Steps

import { STS } from '@aws-sdk/client-sts';
import { AwsCredentialIdentityProvider } from '@smithy/types';

const fromStaticCredentialProvider = async (params) => {
    console.log({ params });
    return {
        accessKeyId: 'accessKeyId',
        secretAccessKey: 'secretAccessKey',
    };
};

interface ExtensionConfiguration {
    setCredentials(credentials: AwsCredentialIdentityProvider): void;
}

class StaticCredentialsExtension {
    static create(): StaticCredentialsExtension {
        return new StaticCredentialsExtension();
    }

    configure(extensionConfiguration: ExtensionConfiguration): void {
        extensionConfiguration.setCredentials(fromStaticCredentialProvider);
    }
}

// When the credentials provider is called when used like this, it receives 
// parameters including `callerClientConfig` which is the expected behavior
new STS({
    credentials: fromStaticCredentialProvider,
}).config
    .credentials()
    .then(console.log);

// When the credentials provider is called when used like this, it does not
// receive any parameters, which is unexpected. The expected behavior is for
// it to receive the same parameters as the usage above.
new STS({
    extensions: [StaticCredentialsExtension.create()],
}).config
    .credentials()
    .then(console.log);

Observed Behavior

When passing an extension that calls a credential provider through the extensions parameter in any SDK client, the credential provider function does not receive any parameters.

Expected Behavior

When passing an extension that calls a credential provider through the extensions parameter in any SDK client, the credential provider function should receive parameters including callerClientConfig. The behavior should be similar as if the credential provider is used through the credentials client config.

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issuequeuedThis issues is on the AWS team's backlog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions