Kralizek / Kralizek/AWSSecretsManagerConfigurationExtensions

Unable to get LocalStack working with version 2.0.0.

Open
#139 1 comment 0 reactions 1 assignee View on GitHub

@Kralizek is already working on this.

Since Jul 1, 2026.

bug
Dominant language
C#
Stars
260
Forks
54
Avg merge
5h 56m
Merged PRs (30d)
5

Description

Package version

2.0.0

.NET SDK / runtime version

8.0

Loading mode

Discovery

AWS Region

us-east-1

Steps to reproduce
  1. Attempt to configure an app to use localstack as follows:
var config = new AmazonSecretsManagerConfig
{
    ServiceURL = "http://localhost:4566",
    UseHttp = true,
    AuthenticationRegion = "us-east-1",
};

var client = new AmazonSecretsManagerClient(
     new BasicAWSCredentials("test", "test"),
     config
 );

builder.Configuration.AddSecretsManagerDiscovery(client);
Expected behaviour

The app is able to start.

Actual behaviour

The following error occurs during startup:

Unhandled exception. Amazon.SecretsManager.AmazonSecretsManagerException: exception while calling secretsmanager with unknown operation: An unknown error occurred when trying to parse the request.
---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.HttpWebRequestMessage.ProcessHttpResponseMessage(HttpResponseMessage responseMessage)
at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
at Amazon.Runtime.Internal.HttpHandler1.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext) --- End of inner exception stack trace --- at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream) at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext executionContext, HttpErrorResponseException exception) at Amazon.Runtime.Internal.ExceptionHandler1.HandleAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.Signer.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.BaseAuthResolverHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.Marshaller.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
at Kralizek.Extensions.Configuration.Internal.SecretsManagerDiscoveryConfigurationProvider.FetchConfigurationBatchAsync(CancellationToken cancellationToken)
at Kralizek.Extensions.Configuration.Internal.SecretsManagerConfigurationProviderBase.LoadAsync()
at Kralizek.Extensions.Configuration.Internal.SecretsManagerConfigurationProviderBase.Load()
at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
at Microsoft.Extensions.Configuration.ConfigurationManager.ConfigurationSources.Add(IConfigurationSource source)
at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
at Microsoft.Extensions.Configuration.SecretsManagerExtensions.AddSecretsManagerDiscovery(IConfigurationBuilder builder, IAmazonSecretsManager client, Action`1 configure)
...

Additional context

The client I am creating is able to talk to localstack. I have added this debug code and it is fetching my secrets:

try
{
    var response = await client.ListSecretsAsync(new ListSecretsRequest());
    Console.WriteLine($"Got {response.SecretList.Count} secrets from LocalStack.");
}
catch (Exception ex)
{
    Console.WriteLine("Direct ListSecrets failed:");
    Console.WriteLine(ex);
}

Localstack was also working fine in version 1.7.0. I was configuring it like this before:

builder.Configuration.AddSecretsManager(configurator: options =>
{
    options.ConfigureSecretsManagerConfig = c =>
        c.ServiceURL = "http://localhost:4566";
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.