Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error message from SystemsManagerExtensions.AddSystemsManager() #3704

Closed
1 task
opottone opened this issue Mar 11, 2025 · 5 comments
Closed
1 task
Labels
bug This issue is a bug. credentials p2 This is a standard priority issue queued

Comments

@opottone
Copy link

opottone commented Mar 11, 2025

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

@opottone opottone added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 11, 2025
@dscpinheiro
Copy link
Contributor

Similar discussion about this problem: #3535

@ashishdhingra
Copy link
Contributor

@opottone Please see inputs from @dscpinheiro and the reasoning provided in #3535 (comment). Most likely this is a feature request to throw better exception message.

@ashishdhingra ashishdhingra added p2 This is a standard priority issue needs-review queued and removed needs-triage This issue or PR still needs to be triaged. needs-review labels Mar 12, 2025
@ashishdhingra
Copy link
Contributor

DOTNET-7910

@ashishdhingra
Copy link
Contributor

This has been addressed in AWSSDK.Core version 4.0.0-preview.12

Copy link

github-actions bot commented Apr 4, 2025

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. credentials p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

3 participants