I'm getting this error in AppSync while trying to create a mutation:
{
"data": {
"sendMessage": null
},
"errors": [
{
"path": [
"sendMessage"
],
"data": null,
"errorType": "MappingTemplate",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 3,
"sourceName": null
}
],
"message": "Unable to convert {dealId=312321312312, from=312321313, to=312321312312, id=7e7a8ba9-8e68-425a-9352-4421706c728a, type=text, body=Teste 122, status=sent} to Object."
}
]
}
The mapping template:
{
"version" : "2017-02-28",
"operation" : "PutItem",
"key" : {
"id": $util.dynamodb.toDynamoDBJson($util.autoId()),
},
"attributeValues" : $util.dynamodb.toMapValuesJson($ctx.args.input)
}
And the Mutation:
mutation MutationTest {
sendMessage(input: {dealId: "312321312312", from: "312321313", type: "text", to: "312321312312", status: "sent", body: "Teste 122"})
}
Thoughts? Thanks!
I think you need at least one return value, so your mutation would look like this:
mutation MutationTest {
sendMessage(input: {dealId: "312321312312", from: "312321313", type: "text", to: "312321312312", status: "sent", body: "Teste 122"}){
dealID
}
}