Home > other >  AWS Step Function Error with Input to Map State
AWS Step Function Error with Input to Map State

Time:06-07

I have the following iteration state defined in a Map State:

     "WriteRteToDB": {
            "Comment": "Write Rte to DB. Also records the risk calculations in the same table.",
            "Type": "Task",
            "Resource": "arn:aws:states:::lambda:invoke",
            "End": true,
            "Parameters": {
              "FunctionName": "logger-lambda",
              "RtInfo.$": "States.Array($)",
              "ExecutionId.$": "$$.Execution.Id",
              "InitTime.$": "$$.Execution.StartTime"
            }

The parameters defined produce the following input:

{
  "FunctionName": "logger-lambda",
  "RtInfo": {
    "status": 200,
    "rte": {
      "date": "2022-06-05 00:00:00",
      "rt_value": 778129128.6631782,
      "lower_80": 0,
      "upper_80": 0.5,
      "location_id": "WeWork Office Space & Coworking, Town Square, Alpharetta, GA, USA",
      "syndrome": "Gastrointestinal"
    }
  },
  "InitTime": "2022-06-05T15:04:57.297Z",
  "ExecutionId": "arn:aws:states:us-east-1:1xxxxxxxxxx1:execution:RadaRx-rteForecast:0dbf2743-abb5-e0b6-56d0-2cc82a24e3b4"
}

But the following Error is produced:

{
  "error": "States.Runtime",
  "cause": "An error occurred while executing the state 'WriteRteToDB' (entered at the event id #28). The Parameters '{\"FunctionName\":\"logger-lambda\",\"RtInfo\":[{\"status\":200,\"rte\":{\"date\":\"2022-12-10 00:00:00\",\"rt_value\":1.3579795204795204,\"lower_80\":0,\"upper_80\":0.5,\"location_id\":\"Atlanta Tech Park, Technology Parkway, Peachtree Corners, GA, USA\",\"syndrome\":\"Influenza Like Illnesses\"}}],\"InitTime\":\"2022-06-05T16:06:10.132Z\",\"ExecutionId\":\"arn:aws:states:us-east-1:1xxxxxxxxxx1:execution:RadaRx-rteForecast:016a37f2-d01c-9bfd-dc3f-1288fb7c1af6\"}' could not be used to start the Task: [The field \"RtInfo\" is not supported by Step Functions]"
}

I have already tried wrapping the RtInfo inside an array of length 1 as you can observe from above, considering that it is a state within the Map State. I have also checked Input size to make sure that it does not cross the Max Input/Output quota of 256KB.

CodePudding user response:

Your task's Parameters has incorrect syntax. Pass RtInfo and the other user-defined inputs under the Payload key:

"Parameters": {
    "FunctionName": "logger-lambda",
    "Payload": {
      "RtInfo.$": "States.Array($)",
      "ExecutionId.$": "$$.Execution.Id",
      "InitTime.$": "$$.Execution.StartTime"
    }
  }
  • Related