Skip to content

Misleading error message from SystemsManagerExtensions.AddSystemsManager() #3704

Closed
@opottone

Description

@opottone

Describe the bug

My application uses AWS Single Sign-On (SSO) for authentication and it also uses SystemsManagerExtensions.AddSystemsManager(). When there is a valid SSO profile but a session has expired, the call fails and throws an exception with message System.ArgumentNullException: Value cannot be null. (Parameter 'Options property cannot be empty: ClientName').

In those circumstances some kind of exception is expected, but the message should be something like "SSO session expired" or "Authentication failure". Then a user could easily solve the problem and retry. With the actual message it takes significantly more time, effort and expertise to find debug the problem.

I'm not quite sure whether the problem is in Amazon.Extensions.Configuration.SystemsManager or AWSSDK.SimpleSystemsManagement.

Regression Issue

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

Expected Behavior

Exception with message "SSO session expired" or "Authentication failure" or something similar.

Current Behavior

Exception with message "System.ArgumentNullException: Value cannot be null. (Parameter 'Options property cannot be empty: ClientName')", stack trace

 Amazon.Runtime.Credentials.Internal.SSOTokenManager.GenerateNewTokenAsync(
SSOTokenManagerGetTokenOptions options, CancellationToken cancellationToken)
   at Amazon.Runtime.Credentials.Internal.SSOTokenManager.GetTokenAsync(SSOToken
ManagerGetTokenOptions options, CancellationToken cancellationToken)
   at Amazon.Runtime.SSOAWSCredentials.GetSsoCredentialsAsync(ICoreAmazonSSO sso
)
   at Amazon.Runtime.SSOAWSCredentials.GenerateNewCredentialsAsync()
   at Amazon.Runtime.RefreshingAWSCredentials.GetCredentialsAsync()
   at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionCont
ext executionContext)
   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext exec
utionContext)
   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext exec
utionContext)
   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext e
xecutionContext)
   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext e
xecutionContext)
   at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionCont
ext executionContext)
   at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext ex
ecutionContext)
   at Amazon.Extensions.Configuration.SystemsManager.Internal.SystemsManagerProc
essor.GetParametersByPathAsync()
   at Amazon.Extensions.Configuration.SystemsManager.Internal.SystemsManagerProc
essor.GetDataAsync()
   at Amazon.Extensions.Configuration.SystemsManager.SystemsManagerConfiguration
Provider.LoadAsync(Boolean reload)
   at Amazon.Extensions.Configuration.SystemsManager.SystemsManagerConfiguration
Provider.Load()
   at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigu
rationSource source)
   at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensio
ns.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
   at Microsoft.Extensions.Configuration.SystemsManagerExtensions.AddSystemsMana
ger(IConfigurationBuilder builder, Action`1 configureSource)
   at Microsoft.Extensions.Configuration.SystemsManagerExtensions.AddSystemsMana
ger(IConfigurationBuilder builder, String path, Boolean optional)

Reproduction Steps

Call SystemsManagerExtensions.AddSystemsManager() in an environment where SSO profile has been set up but SSO login is invalid or expired

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

Amazon.Extensions.Configuration.SystemsManager 6.2.1, AWSSDK.SimpleSystemsManagement 3.7.303.23

Targeted .NET Platform

net8.0

Operating System and version

Windows 10 Pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.credentialsp2This is a standard priority issuequeued

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions