Skip to content

Cannot Load 'Publish To AWS' in AWS Toolkit for Visual Studio - Legacy works

0

I am unable to publish a .net api to Elastic Beanstalk using the "Publish To AWS" right click option in Visual Studio 2022.

After selecting the "Publish to AWS" option, the profile is validated successfully. After 2-3 minutes I get the following: Screenshot of displayed error

I believe this was caused by generating new keys and rebuilding my credential profiles. The credentials are correct and the toolkit successfully interacts with my account. The "Publish to AWS Elastic Beanstalk (Legacy)" option works.

Unsuccessful Resolution Attempts:
  • Double checked appsettings.json and appsettings.development.json AWS node
  • Double checked nuget sources
  • Repair Visual Studio 2022
  • Reinstall AWS Toolkit
  • Delete Toolkit Folder
  • Added permissions to EC2 service policy
Log File:

2024-09-16 17:34:05,634 [88] DEBUG Amazon.AWSToolkit.Publish.ViewModels.PublishToAwsDocumentViewModel - Starting a deployment session 2024-09-16 17:35:45,643 [22] ERROR Amazon.AWSToolkit.Publish.Views.PublishToAwsDocumentControl - Error refreshing publish state Amazon.AWSToolkit.Publish.SessionException: Unable to start a deployment session: A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at AWS.Deploy.ServerMode.Client.RestAPIClient.<StartDeploymentSessionAsync>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.AWSToolkit.Publish.ViewModels.DeployToolController.<StartSessionAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.AWSToolkit.Publish.ViewModels.PublishToAwsDocumentViewModel.<StartDeploymentSessionAsync>d__162.MoveNext() --- End of inner exception stack trace --- at Amazon.AWSToolkit.Publish.ViewModels.PublishToAwsDocumentViewModel.<StartDeploymentSessionAsync>d__162.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.AWSToolkit.Publish.ViewModels.PublishToAwsDocumentViewModel.<RestartDeploymentSessionAsync>d__160.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.AWSToolkit.Publish.Views.PublishToAwsDocumentControl.<RestartDeploymentSessionAsync>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.AWSToolkit.Publish.Views.PublishToAwsDocumentControl.<OnTerminalConnectionManagerStateAsync>d__27.MoveNext() 2024-09-16 17:37:49,849 [122] DEBUG Amazon.AWSToolkit.Telemetry.Internal.TelemetryPublisher - Publishing 7 event(s)

asked 2 years ago359 views

1 Answer
-1

Hello there,

Thank you for reaching out to us.

I see that you are unable to publish a .NET API to Elastic Beanstalk using the "Publish To AWS" right click option in Visual Studio 2022 as you are getting below error message. However it was working fine with Legacy method. Also, I see that you have already attempted some resolution steps however those were not helped in resolving the issue.

Unable to start a deployment session:
A task was canceled

I have checked about the error message and I found that this error might occur when there is no proper permissions to EC2 instance profile role or not selecting the appropriate instance profile in the Visual studio. Please refer the GitHub link for more information[1][2].

I will also suspect that this could be due to instance profile selection or permissions issue since it is failing at "Publish To AWS”. That said, I have referred our official document[3] that “Although not recommended, you may also need to specify AWS account credentials that your application will use to access AWS services after it has been deployed. The preferred approach is to specify an IAM role. In the Publish to Elastic Beanstalk wizard, you do this through the Identity and Access Management Role drop-down list on the AWS Options page. In the legacy Publish to Amazon Web Services wizard, you do this through the IAM Role drop-down list on the AWS Options page.

Since you are suspecting that this was caused by generating new keys and rebuilding my credential profiles. Hence, I would suggest you to please refer the document[3] and make sure that you are using credentials in correct way mentioned in the document. However, I would also suggest you to use preferred approach i.e. IAM role instead of access keys.

If you are unable to fix the issue, I would suggest you to please try steps mentioned in the document[4] and reach out to AWS Premium support by creating a support case with us. We would happy to troubleshoot further.

Thank you and have a nice day

References:
[1] https://github.com/aws/aws-toolkit-visual-studio/issues/352#issuecomment-1890982281

[2] https://github.com/aws/aws-toolkit-visual-studio/issues/352#issuecomment-2047712785

[3] https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/deployment-beanstalk-specify-credentials.html

[4] https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/deployment-beanstalk-traditional.html

AWS
SUPPORT ENGINEER

answered 2 years ago

  • Thank you so much for your answer. Unfortunately, I had already seen these posts and tried the solutions. In my situation, the GUI never launches. I cannot change dropdown settings because the options never load. The first screen to appear is the error screen. I added permissions to the IAM role associated with the instance through the AWS console, but that did not change anything.

  • This does not work. I get the same error using an account with ALL permissions AWS wide enabled. Literally everything.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.