aws / aws/aws-extensions-for-dotnet-cli
ElasticBeanstalk tools different response to "Unable to find credentials" between 3.0.0 and 3.0.1
- Dominant language
- C#
- Stars
- 393
- Forks
- 90
- Avg merge
- 2d 19m
- Merged PRs (30d)
- 3
Description
I'm playing with Elastic Beanstalk for the first time and tried to mistakenly run the deploy command before setting up the AWS credentials.
On `Amazon.ElasticBeanstalk.Tools --version 3.0.0` if you try to run the deploy command immediately after installing:
`dotnet eb deploy-environment --publish-options "--runtime win-x64"`
Then answer the prompts for Application Name, Environment, and Region. You get a message and 3 exceptions:
```
Unknown error executing command: Unable to find credentials
Exception 1 of 3:
Amazon.Runtime.AmazonClientException: Unable to find the 'default' profile in CredentialProfileStoreChain.
at Amazon.Runtime.FallbackCredentialsFactory.GetAWSCredentials(ICredentialProfileSource source)
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 2 of 3:
System.InvalidOperationException: The environment variables AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN were not set with AWS credentials.
Exception 3 of 3:
System.Net.Http.HttpRequestException: No route to host ---> System.Net.Sockets.SocketException: No route to host
```
This is great and informative! But not the same for v 3.0.1.
Doing the same thing command without setting up AWS creds with `Amazon.ElasticBeanstalk.Tools --version 3.0.1` results in this:
```
Unknown error executing command: Host is down
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
at Amazon.Runtime.Internal.Util.AsyncHelpers.<>c__DisplayClass1_1`1.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Amazon.Runtime.Internal.Util.AsyncHelpers.ExclusiveSynchronizationContext.BeginMessageLoop()
at Amazon.Runtime.Internal.Util.AsyncHelpers.RunSync[T](Func`1 task)
at Amazon.Util.AWSSDKUtils.DownloadStringContent(Uri uri, TimeSpan timeout, IWebProxy proxy)
at Amazon.Util.EC2InstanceMetadata.GetItems(String relativeOrAbsolutePath, Int32 tries, Boolean slurp)
at Amazon.Util.EC2InstanceMetadata.get_IAMSecurityCredentials()
at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.FetchCredentials()
at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.GetCredentials()
at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.GetCredentialsAsync()
at Amazon.Runtime.Internal.CredentialsRetriever.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.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.ElasticBeanstalk.Tools.Commands.DeployEnvironmentCommand.DoesApplicationExist(String applicationName) in E:\JenkinsWorkspaces\aws-extensions-for-dotnet-cli\src\Amazon.ElasticBeanstalk.Tools\Commands\DeployEnvironmentCommand.cs:line 414
at Amazon.ElasticBeanstalk.Tools.Commands.DeployEnvironmentCommand.PerformActionAsync() in E:\JenkinsWorkspaces\aws-extensions-for-dotnet-cli\src\Amazon.ElasticBeanstalk.Tools\Commands\DeployEnvironmentCommand.cs:line 104
at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand`1.ExecuteAsync() in E:\JenkinsWorkspaces\aws-extensions-for-dotnet-cli\src\Amazon.Common.DotNetCli.Tools\Commands\BaseCommand.cs:line 44
```
Which is misleading. You can see in the exception itself that get_IAMSecurityCredentials is a source for the exception, but what happened to the helpful message in 3.0.0? `Unable to find credentials`?
I also think an instruction to set up the AWS keys/creds would be welcome in the readme.md
Contributor guide
Research direction
Reproduce the deploy command with Amazon.ElasticBeanstalk.Tools 3.0.1, then inspect DeployEnvironmentCommand.cs around DoesApplicationExist at line 414 and compare the credential error path with version 3.0.0. Check README.md for the setup guidance requested. Done means restoring a useful missing-credentials message and documenting how to configure AWS credentials, with tests or verified command output covering the failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, csharp
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100