Mapping request when Wrapping graphQL(appsync) with GET REST API using Amazon api gateway

Viewed 77

I want to create a GET endpoint as a wrapper over an existing App Sync api for a specific query using AWS Service integration in API Gateway.

Eg. /employee/{id}/residenceCountry

In the mapping template I put the query as

{"query":"query MyQuery {getEmployeeDetails(id: \"$method.request.path.id\") {address {country}}}"}

However, I am getting a 500 Internal server error with no proper logs.

When I create a POST endpoint such that I pass the above body as request body to my rest api with passthrough, it works.

In the execution logs I see the exact same content for Endpoint request body after transformations:

In order to get the proper logs I tried getting $context.error.message and $context.integrationErrorMessage but I do not get any details.

Could someone please tell what I could be doing wrong or how to debug this better?

1 Answers

It turned out to be a very silly mistake of selecting App Sync as AWS Service in GET vs App Sync Data Plane in POST. It was only made apparent via another set of eyes. Thanks to my colleague Albert Hoxha.

Related