AWS AppSync mutation is throwing error when trying to perform update operation. I have correctly created the table and my
Bellow is the GraphQL Schema
type Mutation {
updateStateMutation(input: UpdateData!): ReturnValue
}
input UpdateData {
ID: String
OPP: Int
loc: [Float]
CDC: String
MND: String
CSP: Int
}
type ReturnValue {
ID: String
CDC: String
MND: String
loc: [Float]
CSP: Int
OPP: Int
}
Bellow is the resolver for the mutation
{
"version" : "2017-02-28",
"operation" : "PutItem",
"key" : {
"ID": $util.dynamodb.toDynamoDBJson($ctx.args.ID),
},
"attributeValues" : $util.dynamodb.toMapValuesJson($ctx.args)
}
Bellow is the execution part that I perform on the GraphQL
mutation UpdateStateData {
updateStateMutation(input: {
ID: "100000000-ofo"
CDC: "3E5E65117E877076L"
MND: "6EA8F0DAE8C3D09F"
CSP: 2
}){
ID
CDC
MND
CSP
loc
OPP
}
}
When executed I am getting the error shown below.
{
"data": {
"updateStateMutation": null
},
"errors": [
{
………
"message": "One or more parameter values were invalid: Type mismatch for key ID expected: S actual: NULL (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: MRMBUAFKERB48R7JTH5TUV8I8NVV4KQNSO5AEMVJF66Q9ASUAAJG)"
}
]
}
What is wrong with the above coding. I have correctly given the input but still I am facing the error. The Key name in DynamoDB is ID but, it is still throwing the error.