我正进入(状态
"__type": "com.amazon.coral.service#SerializationException"
作为邮递员和 API 网关测试控制台中的回复
尝试使用 API 代理服务将记录直接发布到 dynamodb。
我指的是这篇 AWS 文章 -https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/ https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/
这是我的映射
{
"TableName": "TableNameGoesHere",
"Item": {
"id" : "$context.requestId"
"eventName" : "$input.path('$.eventName')",
"timestamp" : $input.path('$.timestamp'),
"answers": "$util.parseJson($input.path('$.answers'))"
}
}
更新:
我按照要求做了...并且它有效,但现在如果我尝试添加 JSON 对象数组,它会给我上面相同的错误 - 这就是我现在正在尝试做的事情。请帮忙 - 在谷歌上也找不到任何东西
#set($inputRoot = $input.path('$'))
{
"TableName": "Answer",
"Item": {
"id": {
"S": "$context.requestId"
},
"eventName": {
"S": "$input.path('$.eventName')"
},
"timestamp" : {
"N": "$input.path('$.timestamp')"
},
"answers": {
"S": "$input.path('$.answers')"
},
"Line": {
"S" : "[
#foreach($elem in $inputRoot.Line)
{
"questionID" : "$elem.questionID",
"answer" : "$elem.answer"
}#if($foreach.hasNext),#end
#end
]" }
}
}