Reputation: 21
I keep getting this error message when I try to trigger a mutation through lambda when I add/modify/delete items from DynamoDB:
"message" : "Invalid request,
query
can't be null.",
So what I am trying to do is whenever a modification is done directly on dynamodb, the subscribed users will be notified with the changes.
I have created the new mutation with None type data source. I tested it out directly on the query console and it works fine.
I have also created the lambda function based on Python that is able to retrieve the dynamodb streams and has tested it out with cloudwatch.
Now the issue is when I try to do a HTTP post request from the lambda, i get:
error: MalformedHttpRequestException
message: invalid request,
query
can't be null.
name of mutation: addTodo
the data i am sending over post:
{'operationName': 'addTodo',
'variables':{'id': '400',
'name': 'some name',
'description': 'some description',
'query': 'mutation addTodo($id: ID,
$name: String,
$description: String)
{addTodo(id: $id,
name: $name,
description: $description)
{id name description}}'
}
}
Upvotes: 2
Views: 1538
Reputation: 2037
You have query
inside variables
in your payload but it's expected to be passed outside like this:
{
'operationName': 'addTodo',
'variables': {
'id': '400',
'name': 'some name',
'description': 'some description'
},
'query': 'mutation addTodo(...'
}
Upvotes: 2