By using AWS re:Post, you agree to the Terms of Use
/Error, AWS Step Function DynamoDB Put Item, Map and List inside Map/

Error, AWS Step Function DynamoDB Put Item, Map and List inside Map

0

Hello, I'm having troubles inserting an item in DynamoDB with this Structure from Step Functions.

{
    "id":{
        "S":""
    },
    "state_machine_execution_id":{
        "S":""
    },
    "timestamp":{
        "S":""
    },
    "map_param1":{
        "M":{
            "sub_map1":{
                "M":{ }
            },
            "sub_map2":{
                "S":""
            },
            "sub_map3":{
                "M":{ }
            },
            "sub_mapN":{
                "M":{ }
            },
            "List_1":{
                "L":[ ]
            },
            "List_2":{
                "L":[ ]
            }
        }
    }
}

This is the statement that I am trying to make it work without success

{
    "DynamoDB Save Item":{
        "Type":"Task",
        "Resource":"arn:aws:states:::dynamodb:putItem",
        "Parameters":{
            "TableName.$":"$.TableName",
            "Item":{
                "id.$":"$.id",
                "state_machine_execution_id.$":"$$.Execution.Id",
                "timestamp.$":"$.timestamp",
                "map_param1":{
                    "M":{
                        "M.$":"$.var_for_map_params",
                        "List_1":{
                            "L.$":"$.List_1"
                        },
                        "List_2":{
                            "L.$":"$.List_2"
                        }
                    }
                }
            }
        }
    }
}

I'm getting this error

The Parameters "{A lot of data flow} "could not be used to start the Task: [The field \"foo\" is not supported by Step Functions]"

This "foo" field, has nothing to do, if make changes to the Parameters: map_param1 statement in Step Function works example This works ok

"map_param1":{
        "M.$":"$.var_for_map_params"
}

And This works ok too

"map_param1":{
    "M":{
        "List_1":{
            "L.$":"$.List_1"
        },
        "List_2":{
            "L.$":"$.List_2"
        }
    }
}

But not this (the combination)

"map_param1":{
    "M":{
        "M.$":"$.var_for_map_params",
        "List_1":{
            "L.$":"$.List_1"
        },
        "List_2":{
            "L.$":"$.List_2"
        }
    }
}

Can someone help me?
thanks a lot
Regards

1 Answers
0

Your exact definition worked for me with the following input:

{
  "TableName": "Table",
  "id": "id",
  "timestamp": "timestamp",
  "var_for_map_params": "var_for_map_params",
  "List_1": [
    "item1",
    "item2"
  ],
  "List_2": [
    "item1",
    "item2"
  ]
}

Maybe something with the payload itself. Can you share the input?

EXPERT
answered 5 months ago

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