AmazonServiceException: A WebException with status RequestCanceled was thrown.


Hello community, I have a question regarding an exception that we are getting often and it is causing some extra computation from our side due to the retries that we have to do in order to process a job. During the execution of the job when we try to download some data from S3 using the S3 client we might get the following error: Inner WebException: The request was aborted: The request was canceled. from System at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) at async Amazon.Runtime.Internal.HttpRequest.GetResponseAsync(?) at async Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync at async Amazon.Runtime.Internal.RedirectHandler.InvokeAsync at async Amazon.Runtime.Internal.Unmarshaller.InvokeAsync at async Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeAsync at async Amazon.Runtime.Internal.ErrorHandler.InvokeAsync This is forcing us to fail the job and retry. I would like to mention that before opening this question we have updated our package from : to 3.7.300.1 and the error is still present.

All operations are async before calling the S3 client.

asked 14 days ago118 views
1 Answer


Greetings for the day!

Please note that the error "WebException: The request was aborted: The request was canceled" might be because of below reasons:

    Timeout (100 sec by default)
    Executing async method and not awaiting it
    Executing async void method
    Running job in different task/thread and not waiting it to complete

Please refer the below third party articles: [+] [+] [+] [+]

NOTE : Kindly note that the documents shared here are third party documentation not endorsed by AWS.

If you have any further queries, please feel free to reach out to AWS Support along with your specific error and details, and we would be happy to assist you further.

[+] Creating support cases and case management -

answered 13 days ago
  • Hello, I have a question on your third suggestion "Executing async void method". We are uploading and downloading using async Task signature because ITransferUtility is also using async Task signature and not returning a status or any response back so the entire chain is using async task. Our tasks are awaited indeed, what we haven't done so far is to extend the timeout, but wouldn't the exception be different in case of timeout?

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.

Guidelines for Answering Questions