Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eventbridge input transformation invalid JSON

I am trying to transform an Input that I am receiving from SQS into a valid JSON object using the inputTemplate variable found in an eventbridge pipeline. All I want is to parse the message using the predefined variable <aws.pipes.event.json>. When I use it in the console directly, my input is getting parsed, but when I use in cloudformation, I am getting this error: Invalid json path reference or predefined variable for placeholder number 1.. I have tried following this post's solution, but I am still getting the same error : Cloudformation Cloudwatch InputTemplate Formatting

  Pipe:
    Type: AWS::Pipes::Pipe
    Properties:
      Name: some name
      RoleArn: a role
      Source: queue
      SourceParameters: 
        SqsQueueParameters:
          BatchSize: 1
      Target: state machine
      TargetParameters:
        InputTemplate: <aws.pipes.event.json>
        StepFunctionStateMachineParameters: 
          InvocationType: FIRE_AND_FORGET

Not sure if it matters, but this is what my input would look like:

[{
  "messageId": "059f36b4-87a3-44ab-83d2-661975830a7d",
  "receiptHandle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a...",
  "body": stringified json object,
  "attributes": {
    "ApproximateReceiveCount": "1",
    "SentTimestamp": "1545082649183",
    "SenderId": "AIDAIENQZJOLO23YVJ4VO",
    "ApproximateFirstReceiveTimestamp": "1545082649185"
  },
  "messageAttributes": {},
  "md5OfBody": "e4e68fb7bd0e697a0ae8f1bb342846b3",
  "eventSource": "aws:sqs",
  "eventSourceARN": "arn:aws:sqs:us-east-2:123456789012:my-queue",
  "awsRegion": "us-east-2"
}]

Any help is appreciated, thanks.

like image 488
Josee Avatar asked May 29 '26 19:05

Josee


1 Answers

Just use InputTemplate: '{"event": <aws.pipes.event.json>}'. It works in my app.

like image 103
dobeerman Avatar answered May 31 '26 11:05

dobeerman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!