Reputation: 471
In AppSync VTL, I am attempting to generate log events in my response resolver vtl file, so I would prefer not to skip them.
Below is my request.vtl file.
#foreach($item in $ctx.source.get("songPlays"))
$util.qr($item.put("globalContextStash", $ctx.source.get("globalContextStash")))
$util.qr($item.put("language", $ctx.source.get("language")))
$util.qr($item.put("songStatus", $ctx.source.get("songStatus")))
#end
## This works but I will skip my response.vtl.
#return($ctx.source.songPlays)
## This did not work as I started getting an error.
{
"version" : "2018-05-29",
"data": {
"songPlays": $util.toJson($ctx.source.songPlays)
}
}
## Received similar errors with this one.
$util.toJson($salesPlays)
Upvotes: 0
Views: 236
Reputation: 471
Found that the object key of the returned valued should have been "payload"
{
"version" : "2018-05-29",
"payload": $util.toJson($songPlays)
}
Upvotes: 0