My setup involves an SQS queue that is connected to a FIFO queue through an eventbridge pipe. The pipe extracts a value from the payload and assigns it to the MessageGroupID using a JSONpath expression.
import { SqsTarget } from '@aws-cdk/aws-pipes-targets-alpha';
import { SqsSource } from '@aws-cdk/aws-pipes-sources-alpha';
import * as pipes from '@aws-cdk/aws-pipes-alpha';
const pipe = new pipes.Pipe(
this,
'pipe-name'),
{
source: new SqsSource(sourceQueueSQS),
target: new SqsTarget(targetFifoQueue, {
messageGroupId: '$.body.detail.some.value.used.as.id',
}),
role: pipeRole,
pipeName: 'pipe-name',
},
);
While this configuration successfully adds the messageGroupID as intended, it does introduce an additional nesting layer around the body of the message (SQSEvent). This complicates the deserialization process in my downstream lambda function.
I'm perplexed by this alteration to the body and would appreciate any assistance in understanding the cause behind it.