Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"}
like image 859
Abhishek Kumar Avatar asked Nov 05 '19 13:11

Abhishek Kumar


People also ask

How are messages ordered in a FIFO queue?

Then, each message can be received and processed in the exact order in which the messages were transmitted. In FIFO queues, messages are ordered based on message group ID.

How does Amazon SQS handle messages sent in succession to FIFO?

If multiple messages are sent in succession to a FIFO queue, each with a distinct message deduplication ID, Amazon SQS stores the messages and acknowledges the transmission. Then, each message can be received and processed in the exact order in which the messages were transmitted. In FIFO queues, messages are ordered based on message group ID.

Is it possible to integrate AWS API gateway with AWS SQS?

But, if you want a highly scalable infrastructure that requires almost no maintenance from your team, AWS API Gateway and SQS can be combined fairly easily with a simple integration template.

What does the API gateway API gateway log service return?

Returns an instance of the iam.Role created by the construct for API Gateway for CloudWatch access. Returns an instance of the log group created by the pattern that API Gateway REST API access logs are sent to. Returns an instance of the IAM role created by the pattern for the API Gateway REST API.


Video Answer


1 Answers

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.

like image 51
James Avatar answered Oct 08 '22 15:10

James