Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 478
Omkar Avatar asked Jan 11 '18 16:01

Omkar


1 Answers

Use escape character for your parameters as follows

{
 "input": "{
           \"my_params\": {
             \"config\": \"config_value\"
             }
          }",
  "name": "MyExecution",
  "stateMachineArn": "my-arn"
}
like image 119
Amit Dhara Avatar answered Sep 28 '22 00:09

Amit Dhara