EventBridge pipe transformer not working for arrays

0

I'm trying to set up a simple transformer for an EventBridge pipe that connects a SQS queue to a Step Functions workflow. The SQS queue receives input in the form

[  
  {  
    "key1": "value1",  
    "key2": "value2"  
  }  
]

The workflow expects a similar format but different key identifiers:

[  
  {  
    "workflowKey1": "value1",  
    "workflowKey2": "value2"  
  }  
]

The workflow can also be invoked from other sources so changing the expected input is not easily possible. Clicking on the fields I want to extract in AWS console suggests the following transformer, which unfortunately only extracts empty strings:

{
  "workflowKey1": <$.0.key1>,
  "workflowKey2": <$.0.key2>
}

Is there something wrong with my transformer, or is this an issue with EventBridge pipe itself?

asked 9 months ago551 views
1 Answer
0

Hi, I believe that <$.0.key1> should be turned to <$.[0].key1> to indicate indice 0 of the surrounding array. Best, Didier

profile pictureAWS
EXPERT
answered 9 months ago
  • I tried that but it gives me a Transformer is invalid: Invalid syntax error. Same when I try <$[0].key1>

  • I have the same issue. I cannot find a good way to perform this. Is there any good documentation about the transformation package?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions