2

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}}'
                }
}

1 Answer 1

2

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(...'
}
Sign up to request clarification or add additional context in comments.

1 Comment

Agreed, but the documentation still has it setup incorrectly. docs.amplify.aws/guides/functions/graphql-from-lambda/q/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.