SerializationException:Start of structure or map found where not expected: API Gateway to Step function

11,428

Use escape character for your parameters as follows

{
 "input": "{
           \"my_params\": {
             \"config\": \"config_value\"
             }
          }",
  "name": "MyExecution",
  "stateMachineArn": "my-arn"
}
Share:
11,428
Omkar
Author by

Omkar

Updated on June 04, 2022

Comments

  • Omkar
    Omkar almost 2 years

    I am using the standard blog tutorial on integrating api gateway with step functions from here: https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-api-gateway.html

    My step function expects the following output:

    {
      "my_params": {
         "config": "config_value"
      }
    }
    

    the Request body needed to do a post request as mentioned in the blog is:

    {
     "input": "{}",
       "name": "MyExecution",
       "stateMachineArn": "arn:aws:states:us-east-1:123456789012:stateMachine:HelloWorld"
    }
    

    I am passing my required input like this:

    {
     "input": {
               "my_params": {
                 "config": "config_value"
                 }
              },
      "name": "MyExecution",
      "stateMachineArn": "my-arn"
    }
    

    However, I am continuously getting following error:

    {
    "__type": "com.amazon.coral.service#SerializationException",
      "Message": "Start of structure or map found where not expected."
    }
    

    Can someone tell me what exactly is the problem here? What am I doing wrong here? Quick help appreciated.