Skip to content

AwsSmithyClientT does not pass in m_serviceName param when initialising endpointProvider #3907

Closed

Description

@Renz456

Describe the bug

We are trying to upgrade from SDK version 1.11.352 to 1.11.800 and noticed the following:
STS moved to AwsSmithyClientT; its generic initialization omitted m_serviceName, here: m_endpointProvider->InitBuiltInParameters(m_clientConfiguration);.

Endpoint configuration only consults AWS_ENDPOINT_URL_STS and global AWS_ENDPOINT_URL when a service name is supplied.

It looks like

  • PR #3236 [release 1.11.483] introduced the Smithy Client initialising without service name.
  • PR #3597 [release 1.11.685] added service-aware endpoint initialization and updated ordinary generated clients to pass SERVICE_NAME, but did not update the shared AwsSmithyClientT call.
  • PR #3793 [release 1.11.790] Migrated STS from the legacy client to AwsSmithyClientT, making STS inherit the omission. This is where the observable STS regression began.

Regression Issue

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

Expected Behavior

STS clients created through AwsSmithyClientT should honor the standard AWS endpoint override configuration, including the
service-specific AWS_ENDPOINT_URL_STS environment variable and the global AWS_ENDPOINT_URL environment variable.

AwsSmithyClientT should pass its stored service name to the endpoint provider during initialization:

m_endpointProvider->InitBuiltInParameters(
    m_clientConfiguration,
    m_serviceName
);

This should make STS endpoint resolution behave consistently with the legacy STS client and other generated AWS service
clients.

Current Behavior

AwsSmithyClientT::initClient() calls the one-argument overload:

m_endpointProvider->InitBuiltInParameters(m_clientConfiguration);

Because the stored service name is not supplied, the endpoint provider does not resolve AWS_ENDPOINT_URL_STS or the
global AWS_ENDPOINT_URL.

Starting with 1.11.790, STS uses AwsSmithyClientT, so STS requests ignore these environment-configured endpoint overrides
and instead use the normal AWS STS endpoint. Explicitly setting ClientConfiguration::endpointOverride is unaffected.

Reproduction Steps

  #include <memory>
  #include <string>

  #include <aws/core/Aws.h>
  #include <aws/core/auth/AWSCredentials.h>
  #include <aws/core/client/GenericClientConfiguration.h>
  #include <aws/core/utils/memory/stl/AWSString.h>
  #include <aws/sts/STSClient.h>
  #include <aws/sts/STSEndpointProvider.h>
  #include <gtest/gtest.h>

  namespace {

  class AwsApi final {
    public:
      AwsApi() {
          Aws::InitAPI(options);
      }

      ~AwsApi() {
          Aws::ShutdownAPI(options);
      }

    private:
      Aws::SDKOptions options;
  };

  class RecordingStsEndpointProvider final
      : public Aws::STS::Endpoint::STSEndpointProvider {
    public:
      void InitBuiltInParameters(
          const Aws::Client::GenericClientConfiguration& config
      ) override {
          ++generic_init_calls;
          Aws::STS::Endpoint::STSEndpointProvider::
              InitBuiltInParameters(config);
      }

      void InitBuiltInParameters(
          const Aws::Client::GenericClientConfiguration& config,
          const Aws::String& service_name
      ) override {
          ++service_init_calls;
          initialized_service_name = service_name.c_str();

          Aws::STS::Endpoint::STSEndpointProvider::
              InitBuiltInParameters(config, service_name);
      }

      int generic_init_calls = 0;
      int service_init_calls = 0;
      std::string initialized_service_name;
  };

  TEST(
      AwsStsEndpointInitializationTest,
      SmithyClientPassesServiceNameToEndpointProvider
  ) {
      AwsApi aws_api;
      auto endpoint_provider =
          std::make_shared<RecordingStsEndpointProvider>();

      const Aws::Auth::AWSCredentials credentials(
          "test-access-key",
          "test-secret-key"
      );
      const Aws::Client::GenericClientConfiguration config;

      const Aws::STS::STSClient client(
          credentials,
          endpoint_provider,
          config
      );

      EXPECT_EQ(endpoint_provider->service_init_calls, 1);
      EXPECT_EQ(endpoint_provider->generic_init_calls, 0);
      EXPECT_EQ(endpoint_provider->initialized_service_name, "sts");
  }

  }  // namespace

Possible Solution

Would changing the call in AwsSmithyClientT::initClient() to the following be the intended fix?

  m_endpointProvider->InitBuiltInParameters(
       m_clientConfiguration,
       m_serviceName

Additional Information/Context

No response

AWS CPP SDK version used

1.11.800

Compiler and Version used

GCC/G++ 12.3.0

Operating System and version

Debian GNU/Linux 12 (bookworm)

Activity

  1. added
    bugThis issue is a bug.
    needs-triageThis issue or PR still needs to be triaged.
    on Aug 31, 2026
  2. added a commit that references this issue on Aug 31, 2026
    c4ca155
  3. sbiscigl commented on Aug 31, 2026

    @sbiscigl
    Contributor

    Hey @Renz456 thanks for opening the issue, and i think you are completely correct, running a simple test

    #include <aws/core/Aws.h>
    #include <aws/sts/STSClient.h>
    
    using namespace Aws;
    using namespace Aws::STS;
    
    auto main() -> int {
      SDKOptions options{};
      options.loggingOptions.logLevel = Utils::Logging::LogLevel::Debug;
      InitAPI(options);
      {
        STSClient sts_client{};
        const auto identity = sts_client.GetCallerIdentity();
      }
      ShutdownAPI(options);
      return 0;
    }

    with AWS_ENDPOINT_URL_STS=foobar i see it not working/working before and after your change. it seems that when we added support for service specific endpoints we missed smithy based clients. saw you opened a PR lemme take a look at it.

  4. added
    p2This is a standard priority issue
    and removed
    needs-triageThis issue or PR still needs to be triaged.
    on Sep 1, 2026
  5. sbiscigl commented on Sep 1, 2026

    @sbiscigl
    Contributor

    just as a heads up where we're with it, from running your suggested change on CI it tugged at a thread that showed a lot more was broken then previously thought, so updated your PR with a commit that will address that, after a successful CI run we should be able to merge it

  6. added 2 commits that reference this issue on Sep 1, 2026
    ddcd72d
    0055ac0
  7. Renz456 commented on Sep 1, 2026

    @Renz456
    Author

    Thank you for the quick response + fix :)

  8. sbiscigl commented on Sep 2, 2026

    @sbiscigl
    Contributor

    fix is merged now, should be released today in version 1.11.885, thanks for bringing this up and helping us push a fix!

  9. added
    pending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.
    response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 10 days.
    on Sep 2, 2026
  10. added a commit that references this issue on Sep 2, 2026
    249aa34
  11. sbiscigl commented on Sep 2, 2026

    @sbiscigl
    Contributor

    its been released as 1.11.885 today, resolving this issue, feel free to open a new one if you find anything!

  12. github-actions commented on Sep 2, 2026

    @github-actions

    This issue is now closed. Comments on closed issues are hard for our team to see.
    If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p2This is a standard priority issuepending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 10 days.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions