Search code examples
amazon-web-servicesaws-api-gatewayamazon-sqs

Unable to send message from API Gateway to FIFO SQS


I have integrated a API Gateway with FIFO SQS queue using below link https://medium.com/@pranaysankpal/aws-api-gateway-proxy-for-sqs-simple-queue-service-5b08fe18ce50

Below is the snippet of role policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "sqs:SendMessageBatch",
                "sqs:ReceiveMessage",
                "sqs:SendMessage"
            ],
            "Resource": "arn:aws:sqs:*:12345678:Stg"
        }
    ]
}

Whenever is try to test it from API Gateway it throws below error:- "Message": "The request must contain the parameter MessageGroupId."

So I tried to send it via query string but still the error persist.

I have followed the same steps as per the above link for body template and header.

MessageGroupId=098

Simply passing above value in query string and body is below

{"ty":"ui"}

Solution

  • You need to add MessageGroupId, and MessageDeduplicationId to the URL Query String Parameters in Method Execution. Same way you did for MessageBody.

    You'll also need to add MessageGroupId, and MessageDeduplicationId to Integration Request. Again the same way you did with MessageBody.