4

Introduction

Currently, we're using AWS AppSync as API entry point for our proper GraphQL API.

The point is that we need to retrieve the original GraphQL query from the request AppSync sends to our GraphQL API.

In brief we have:

Client --[original query]--> AppSync (build its own request from client query) --[modified request]--> GraphQL API

Where we are missing the original query to the GraphQL API.

Comparison with documentation

Here the documentation of AWS AppSync mapping: https://docs.aws.amazon.com/appsync/latest/devguide/resolver-context-reference.html#aws-appsync-resolver-context-reference-info.

The field context.info.selectionSetGraphQL should be our solution but we don't receive the same content as the documentation ; in documentation, it seems to store the whole original query, however in practice we only get selected fields, not the complete query.

Attempts

We tried to rebuild the original query string from AWS AppSync request fields, but it's overwhelming to handle query arguments as they are in JSON in the request and can be objects with arbitrary depth. Example:

{
  "input": {
    "group": {
      "members": []
    }
  }
}

Do you have any suggestion? Thanks by advance.

Mpu-Mypl
  • 41
  • 3
  • Did you find answer to this problem? Having the same issue – PatrykMilewski Jun 27 '23 at 13:08
  • @PatrykMilewski not really.. As a workaround, we've moved to API Gateway (https://aws.amazon.com/api-gateway/) with our GraphQL app deployed as a unique REST endpoint. It works fine with our architecture. – Mpu-Mypl Jun 28 '23 at 14:25

0 Answers0