poundifdef / smoothmq

An improved drop-in replacement for SQS
https://www.smoothmq.com
GNU Affero General Public License v3.0
2.04k stars 35 forks source link

Creating a duplicate queue should give a proper error code #26

Closed sundbry closed 1 month ago

sundbry commented 1 month ago

When creating a duplicate queue name, the server responds with a 500 status code. It should instead provide a 4xx class error / code compatible with the SQS API, so that clients can easily distinguish between failure to create a queue because of duplication, and actual internal server errors / unavailability.

In this case, I believe InvalidParameterValue is the correct error code.

Java SDK exception:

com.amazonaws.services.sqs.model.AmazonSQSException: UNIQUE constraint failed: queues.tenant_id, queues.name (Service: AmazonSQS; Status Code: 500; Error Code: InternalFailure; Request ID: nu
ll; Proxy: null)
poundifdef commented 1 month ago

Thanks for this - I have a fix in another branch and will merge in the next couple of days!

poundifdef commented 1 month ago

This is now fixed the the lastest main. I've completely re-hauled the underlying SQLite db, so you will probably have to delete and create a new one when you deploy!