Admiral-Piett / goaws

AWS (SQS/SNS) Clone for Development testing
MIT License
788 stars 146 forks source link

Bad Request on SQS API Calls #327

Closed galvesribeiro closed 3 weeks ago

galvesribeiro commented 1 month ago

Hello!

We are getting the following exception while using AWS Messaging SDK for .Net:

2024-10-17T21:45:10.8734080 fail: AWS.Messaging.SQS.SQSMessagePoller[0]
      Failed to extend the visibility of message(s) [d7d28694-e211-4d22-9597-6e597ebaa734] on queue XXXXXXXXX
      Amazon.SQS.AmazonSQSException: The service returned an error with HTTP Body: Bad Request
       ---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
         at Amazon.Runtime.HttpWebRequestMessage.ProcessHttpResponseMessage(HttpResponseMessage responseMessage)
         at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
         at Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync[T](IExecutionContext executionContext)
         at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)
         at Amazon.SQS.Internal.ValidationResponseHandler.InvokeAsync[T](IExecutionContext executionContext)
         at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
         --- End of inner exception stack trace ---
         at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream)
         at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext executionContext, HttpErrorResponseException exception)
         at Amazon.Runtime.Internal.ExceptionHandler`1.HandleAsync(IExecutionContext executionContext, Exception exception)
         at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext executionContext, Exception exception)
         at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
         at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
         at Amazon.Runtime.Internal.Signer.InvokeAsync[T](IExecutionContext executionContext)
         at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
         at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
         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 AWS.Messaging.SQS.SQSMessagePoller.ExtendMessageVisibilityTimeoutAsync(IEnumerable`1 messages, CancellationToken token)

That apparently happens when that SDK tries to use the ChangeMessageVisibility API internally. We have no way to control it as it happens internally on this SDK nor can I find any logs on the output of goaws that could lead us to any clues.

Do you guys know if this is actually implemented on goaws and if there is a know issue on this?

Thanks!

Admiral-Piett commented 1 month ago

Couple questions for some more context.

What AWS operation or series of operations are you calling that triggers this?

What version of the API are you on?

galvesribeiro commented 1 month ago

Hello!

This is because handler of the message takes more than 30s to process it. Since the processing is running without a problem (i.e. no error was thrown to the SDK), the SDK call the change visibility to extend the amount of time that the message is not visible to other consumers.

You can see here more details on how it behave: https://github.com/awslabs/aws-dotnet-messaging/blob/0541a95355918657c2c0255889a6804b3145074c/docs/docs/design/message-visibility-timeout-handling.md

We are using latest version of their package so I would assume they are using the latest version of the API, whatever it is.

Admiral-Piett commented 1 month ago

Sorry, that's not quite what I was asking for. I'm trying to get a full picture of what the context is and what GoAws is going through when it gives you a bad request.

So:

Admiral-Piett commented 3 weeks ago

@galvesribeiro Going to close this down for now, since I haven't heard from you in a bit. Let me know if you're still having trouble with the new versions and we can reopen it. Thanks.