Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoking AWS Gateway API: com.amazon.coral.service#SerializationException

ers,

I am invoking the AWS Api but I am getting a

Endpoint response body before transformations: 
{"__type":"com.amazon.coral.service#SerializationException"}
Endpoint response body before transformations:
{
"__type": "com.amazon.coral.service#SerializationException"
}

Error after a specific post of the same type of jobs. I've enabled detailed Cloudwatch logging but it doesn't give me any additional information. Moreover, the concerned API request body is truncated before and after transformations.

Are there some additional log options to test? I think I just have to take the original API call in JSON and remove fields from them in order to see what makes it break?

like image 760
helloworld Avatar asked Jul 16 '26 04:07

helloworld


2 Answers

I was getting this error on a API Gateway REST API directly integrated with a DynamoDB table using a VTL mapping template. The error started after I changed the mapping template.

HTTP/2 200

{"__type":"com.amazon.coral.service#SerializationException"}

Upon checking the mapping template JSON with an online 'JSON Validator' tool i found that my template wasnt valid JSON. (I had an extra , character in a list of objects). Fixing the template so that it was valid JSON fixed the error

like image 184
Harry Anderson Avatar answered Jul 18 '26 10:07

Harry Anderson


I finally fixed by providing the following mapping template in the integration request:

 #set($input = $input.json('$'))
  {
     "input": "$util.escapeJavaScript($input).replaceAll("\\'", "'")",
   "stateMachineArn": "arn:aws:states:xxxxxxxxxxx"
  }

A bit of a nasty fix, but it worked...

like image 23
helloworld Avatar answered Jul 18 '26 10:07

helloworld