Repository: localstack/localstack

Issue:
bug: SQS SendMessage InvalidParameterValue DelaySeconds 0
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

I have an application which uses SQS.
It works in production.
It has acceptance tests which were passing with localstack until very recently.

Now I see:

```
An error occurred (InvalidParameterValue) when calling the SendMessage operation: Value 0 for parameter DelaySeconds is invalid. Reason: The request include parameter that is not valid for this queue type.
```

Yes, delay `0` is being passed in to `send_message` but this used to work in both localstack and AWS.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html#SQS.Client.send_message

> DelaySeconds (integer) --
The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. 

### Expected Behavior

DelaySeconds 0 is a valid value.

sqs send_message works when explicitly setting delay 0.

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    docker run localstack/localstack

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

1. Create a SQS FIFO queue.
2. Try to `send_message`, specifying `DelaySeconds=0`

### Environment

```markdown
- OS: macos
- LocalStack: latest
```


### Anything else?

I notice on a recent issue that @thrau said he recently changed how SQS attribute values are validated.


Discussion:
If I pin version in `docker-compose.yml` to `1.0.3`, it works.
`latest`, as of now, reproduces the issue.
_Possibly_ due to #6591

Resolving patch:
diff --git a/localstack/services/sqs/provider.py b/localstack/services/sqs/provider.py
--- a/localstack/services/sqs/provider.py
+++ b/localstack/services/sqs/provider.py
@@ -638,8 +638,8 @@ def put(
         message_group_id: str = None,
         delay_seconds: int = None,
     ):
-        if delay_seconds is not None:
-            # in fifo queues, delay is only applied on queue level
+        if delay_seconds:
+            # in fifo queues, delay is only applied on queue level. However, explicitly setting delay_seconds=0 is valid
             raise InvalidParameterValue(
                 f"Value {delay_seconds} for parameter DelaySeconds is invalid. Reason: The request include parameter "
                 f"that is not valid for this queue type."


Test patch:
diff --git a/tests/integration/test_sqs.py b/tests/integration/test_sqs.py
--- a/tests/integration/test_sqs.py
+++ b/tests/integration/test_sqs.py
@@ -454,6 +454,24 @@ def test_create_fifo_queue_with_same_attributes_is_idempotent(self, sqs_create_q
         queue_url = sqs_create_queue(QueueName=queue_name, Attributes=attributes)
         assert sqs_create_queue(QueueName=queue_name, Attributes=attributes) == queue_url
 
+    @pytest.mark.aws_validated
+    def test_send_message_with_delay_0_works_for_fifo(self, sqs_client, sqs_create_queue):
+        # see issue https://github.com/localstack/localstack/issues/6612
+        queue_name = f"queue-{short_uid()}.fifo"
+        attributes = {"FifoQueue": "true"}
+        queue_url = sqs_create_queue(QueueName=queue_name, Attributes=attributes)
+        message_sent_hash = sqs_client.send_message(
+            QueueUrl=queue_url,
+            DelaySeconds=0,
+            MessageBody="Hello World!",
+            MessageGroupId="test",
+            MessageDeduplicationId="42",
+        )["MD5OfMessageBody"]
+        message_received_hash = sqs_client.receive_message(QueueUrl=queue_url, VisibilityTimeout=0)[
+            "Messages"
+        ][0]["MD5OfBody"]
+        assert message_sent_hash == message_received_hash
+
     @pytest.mark.aws_validated
     def test_create_queue_with_different_attributes_raises_exception(
         self, sqs_client, sqs_create_queue, snapshot