softwaremill / elasticmq

In-memory message queue with an Amazon SQS-compatible interface. Runs stand-alone or embedded.
https://softwaremill.com/open-source/
Apache License 2.0
2.55k stars 196 forks source link

Bug: Unexpected ` MissingQueryParamRejection(QueueUrl)` in SQS `SendMessage` when using a context path #585

Closed Hamzaan-Bridle closed 2 years ago

Hamzaan-Bridle commented 2 years ago

When setting node-address.context-path to a non-empty value, calls to SqsClient.sendMessage stop working.
Issue disappears if node-address.context-path = ""

Calls to SqsClient.getQueueUrl still work, so I think the issue is in the way QueueDirectives.scala#L46 is parsing the request.

Info from some debug logging:

Starting ElasticMQ server on http://localhost:34998/context                                                     
Slf4jLogger started                                                                                             
Started SQS rest server, bind address 0.0.0.0:34998, visible server address http://localhost:34998/context      
Started statistics rest server, bind address 0.0.0.0:34999                                                      
Creating queue QueueData(test-queue-1,MillisVisibilityTimeout(30000),PT0S,PT0S,2021-12-08T13:03:10.252Z,2021-12-08T13:03:10.252Z,None,false,false,None,None,Map())
Dec 08, 2021 1:03:12 PM TestClientClass getQueueUrlFromSqs
DEBUG: GetQueueUrlRequest(QueueName=test-queue-1)
Dec 08, 2021 1:03:13 PM TestClientClass getQueueUrlFromSqs
DEBUG: GetQueueUrlResponse(QueueUrl=http://localhost:34998/context/000000000000/test-queue-1)
Dec 08, 2021 1:03:13 PM TestClientClass addMessage
DEBUG: SendMessageRequest(QueueUrl=http://localhost:34998/context/000000000000/test-queue-1, MessageBody=This is the message)
Dec 08, 2021 1:03:13 PM TestClientClass addMessage
DEBUG: software.amazon.awssdk.services.sqs.model.SqsException: Invalid request: MissingQueryParamRejection(QueueName), MissingQueryParamRejection(QueueUrl); see the SQS docs. (Service: Sqs, Status Code: 400, Request ID: 00000000-0000-0000-0000-000000000000, Extended Request ID: null)                                                                                                              

Issue occurred using on:

Hamzaan-Bridle commented 2 years ago

Much appreciated @micossow! 😄

micossow commented 2 years ago

you are welcome, it's fixed in v1.3.6 :)