1

I followed the first part of this tutorial (until code snippet 4) on GraphQL and serverless.

After deploying the serverless application to AWS I query GraphQL using curl, as shown in snippet 4 of the tutorial and get a response as expected:

$ curl -G 'https://example.execute-api.us-east-1.amazonaws.com/dev/query' --data-urlencode 'query={greeting(firstName: "Jeremy")}'
{"data":{"greeting":"Hello, Jeremy."}}

My problem is that when I attempt to make the same query with either Insomnia or Postman, I get 403 error.

What am I doing wrong? Thank you.

In Insomnia:

Insomnia error

In Postman Postman error

Nicolai Lissau
  • 7,298
  • 5
  • 43
  • 57
  • For postman, I think you need to add your query request to the request body - this is the only way I was able to get postman to work with AWS AppSync. – Michael Doye Apr 09 '19 at 12:48
  • The query request is added to the body of the request already. I used Postman to interpret the curl command with File->Import->Raw Text and pasted the working curl command – Nicolai Lissau Apr 09 '19 at 12:58

2 Answers2

1

I solved the problem.

While I never got Insomnia to work, I got Postman working.

Turns out that while the configuration in the Postman screenshot I included is correct, I simply forgot that I still had content in the body of the request, which caused the error.

So: Make sure that no query is included in Body if you want to make a GET request

Make sure that no query is included in Body

Nicolai Lissau
  • 7,298
  • 5
  • 43
  • 57
0

To query from Insomnia:

  1. Have an empty body

  2. In the query tab, add a query property with your GraphQL query

  3. In the Header tab, add a x-api-key property with your api key

Carlos Torres
  • 419
  • 2
  • 9
  • 19