I am new to AWS and I am trying to update a value in the DynamoDB using query and it is returning me below error
The provided key element does not match the schema
The code done and the response is listed below
Error Response
{
"data": {
"updateIsRead": null
},
"errors": [
{
"path": [
"updateIsRead"
],
"data": null,
"errorType": "DynamoDB:AmazonDynamoDBException",
"errorInfo": null,
"locations": [
{
"line": 30,
"column": 3
}
],
"message": "The provided key element does not match the schema (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: 7ELPDK32SD0K9TGT31J03ANHVNVV4KQNSO5AEMVJF66Q9ASUAAJG)"
}
]
}
Query
//I want to update the isRead key value to true of below messageId
mutation UpdateISRead{
updateIsRead(input:{messageId:"3253b0b4-6645-4df2-952f-93694cc70af3"}){
messageId
}
}
Schema
type Mutation {
updateIsRead(input: MessageIDInput!): MessageRecipient
}
type MessageRecipient {
messageId: ID!
messageRecipientId: String!
receiverId: String!
isRead: Boolean!
}
Resolver for Mutation.updateIsRead
{
"version" : "2017-02-28",
"operation" : "UpdateItem",
"key" : {
"messageId" : $util.dynamodb.toDynamoDBJson($ctx.args.messageId)
},
"update" : {
"expression" : "SET #fieldName = :fieldValue",
"expressionNames" : {
"#fieldName" : "isRead"
},
"expressionValues" : {
":fieldValue" : { "BOOL" : true }
}
}
}
Any help in this is much appreciated. Thanks in Advance.