Search code examples
amazon-web-servicesamazon-sqs

UnexpectedParameter MessageGroupId for SQS


I have created a FIFO SQS queue. When sending a message to the queue using the below params,

var params= {
    MessageBody: payload, 
    QueueUrl: sqsURL + body.device + ".fifo"
}
sqs.sendMessage(params, function(err, res) { 
    err ? callback(err) : callback(null, res);
});

I get a warning that says "missing parameter messagegroupid" enter image description here

I then proceed to add in MessageGroupId into my params.

var params= {
    MessageBody: payload,
    MessageGroupId: "posts",
    QueueUrl: sqsURL + body.device + ".fifo"
}
sqs.sendMessage(params, function(err, res) { 
    err ? callback(err) : callback(null, res);
});

enter image description here SQS then throws me "UnexpectedParameter: Unexpected key 'MessageGroupId' found in params".

Am confused by this set of conflicting instructions. I'm using the same SDK region in both my createQueue and sendMessage command.

var sqs= new aws.SQS({ region: "us-east-2" });

Solution

  • I ran into this same error using Lambda (hence finding your post). Wondering if they forgot to refresh the native SDK, I uploaded the latest version of the SDK(2.7.7) with my function and the error went away.

    Since uploading the SDK removes the ability to edit in Lambda, I then deleted it and re-uploaded the function the error came back :(.

    So for now, if you want to use it with Lambda, you have to include the SDK with your deployment package.