400 response without any context in AWS Appsync where Lambda is a Data source

400 response without any context in AWS Appsync where Lambda is a Data source


0

I’m getting the below response in AWS Appsync console, when i try to invoke graphql API.

Request failed with status code 400

Query:

query MyQuery {
  getUserData(inputArguments: $inputArguments) {
    __typename
  }
}

Variables:

{
    "inputArguments": {
    }
}

I’m unable to debug it as Lambda is not being invoked.

1 Answer
1


0

This is very likely caused by insufficient rights. Does Appsync have the rights to call the Lambda function?

Somawhat similar problem discussed here
https://github.com/aws/aws-cdk/issues/19239

Excerpt code from the linked issue that was the solution. It grants appsync.amazonaws.com rights to call the ‘authorizerLambda’ lambda:

    authorizerLambda.addPermission("appsync", {
      principal: new ServicePrincipal('appsync.amazonaws.com'),
      action: 'lambda:InvokeFunction',
    })

New contributor

User987 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



Leave a Reply

Your email address will not be published. Required fields are marked *