Repository: MassTransit/MassTransit

Issue #2665: Amazon SQS Queue Name Limit is 80, Temporary Queue Names Can Be Longer
Created: 2021-07-12T11:44:19Z
The MachineName of an instance in Amazon can be really long, pushing the bus endpoint name to > 80 characters.
Trim the MachineName if the resulting queue name ends up being too long.

Duplicate issue #2667: Queue name exceeds the max allowed 80 character limit in AWS SQS
Created: 2021-07-12T12:52:10Z
Is this a bug report?
Yes
Can you also reproduce the problem with the latest version?
Yes
Environment

Dotnet version: 3.1
Operating system: Linux
IDE (Rider, VS Code, Visual Studio): Visual Studio

Issue
It seems as if the queue that's created behind the scene exceeds the max length of a queue name in AWS SQS.
Amazon.SQS.AmazonSQSException: Can only include alphanumeric characters, hyphens, or underscores. 1 to 80 in length
---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
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.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 MassTransit.AmazonSqsTransport.Contexts.QueueCache.CreateMissingQueue(Queue queue)
at MassTransit.AmazonSqsTransport.Contexts.QueueCache.<>c__DisplayClass8_0.<<Get>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at GreenPipes.Caching.Internals.PendingValue`2.CreateValue()
at MassTransit.AmazonSqsTransport.Pipeline.ConfigureTopologyFilter`1.Declare(ClientContext context, Queue queue)
at MassTransit.AmazonSqsTransport.Pipeline.ConfigureTopologyFilter`1.ConfigureTopology(ClientContext context)
at MassTransit.AmazonSqsTransport.Pipeline.ConfigureTopologyFilter`1.<>c__DisplayClass3_0.<<GreenPipes-IFilter<MassTransit-AmazonSqsTransport-ClientContext>-Send>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at GreenPipes.PipeExtensions.OneTimeSetup[T](PipeContext context, Func`2 setupMethod, PayloadFactory`1 payloadFactory)
at GreenPipes.PipeExtensions.OneTimeSetup[T](PipeContext context, Func`2 setupMethod, PayloadFactory`1 payloadFactory)
at MassTransit.AmazonSqsTransport.Pipeline.ConfigureTopologyFilter`1.GreenPipes.IFilter<MassTransit.AmazonSqsTransport.ClientContext>.Send(ClientContext context, IPipe`1 next)
at MassTransit.AmazonSqsTransport.Transport.SqsMoveTransport.Move(ReceiveContext context, Action`2 preSend)
at MassTransit.Pipeline.Filters.DeadLetterTransportFilter.GreenPipes.IFilter<MassTransit.ReceiveContext>.Send(ReceiveContext context, IPipe`1 next)
at MassTransit.Pipeline.Filters.DeadLetterFilter.GreenPipes.IFilter<MassTransit.ReceiveContext>.Send(ReceiveContext context, IPipe`1 next)
at MassTransit.Transports.ReceivePipeDispatcher.Dispatch(ReceiveContext context, ReceiveLockContext receiveLock)
at MassTransit.Transports.ReceivePipeDispatcher.Dispatch(ReceiveContext context, ReceiveLockContext receiveLock)
at MassTransit.Transports.ReceivePipeDispatcher.Dispatch(ReceiveContext context, ReceiveLockContext receiveLock)
at MassTransit.AmazonSqsTransport.Pipeline.AmazonSqsMessageReceiver.HandleMessage(Message message)

This is the Response message that's currently stuck on amazonsqs://eu-west-1/cef20d77cbd84a16963f3d2afffcb1021608071349_DeliveryAPI_bus_iobyyyfj9afftx-i981s7?durable=false&autodelete=true:
{
  "messageId": "030b0000-4418-0a61-4b8d-08d942d65ffc",
  "requestId": "ac020000-a9fe-0a58-382e-08d942d63df1",
  "conversationId": "ac020000-a9fe-0a58-48bc-08d942d63df1",
  "initiatorId": "ac020000-a9fe-0a58-382e-08d942d63df1",
  "sourceAddress": "amazonsqs://eu-west-1/usermanagement-queries",
  "destinationAddress": "amazonsqs://eu-west-1/cef20d77cbd84a16963f3d2afffcb1021608071349_DeliveryAPI_bus_iobyyyfj9afftx-i981s7?durable=false&autodelete=true",
  "messageType": [
    "urn:message:UserManagement.Events.RequestResponses:IUserResponse"
  ],
  "message": {
    "...": "..."
  },
  "expirationTime": "2021-07-09T12:37:56.0441209Z",
  "sentTime": "2021-07-09T12:37:55.0440333Z",
  "headers": {},
  "host": {
    "machineName": "54abbb3224d34ec2bcb6d3734d72f2ea-3265161081",
    "processName": "UserManagement.API",
    "processId": 1,
    "assembly": "UserManagement.API",
    "assemblyVersion": "8.20.0.0",
    "frameworkVersion": "3.1.16",
    "massTransitVersion": "7.1.6.0",
    "operatingSystemVersion": "Unix 4.14.231.180"
  }
}

Closing comment (2021-07-12T13:13:08Z): Duplicate: #2665