Skip to content

Add Direct Lambda Resolver Event Format (AppSync) to Event Definitions #1014

Closed
@46ki75

Description

@46ki75

We’d like to propose adding support for the event schema used by Direct Lambda Resolvers in AWS AppSync.

Background

When using AppSync with AWS Lambda as a data source, users often create a "Function" (VTL mapping template) that transforms the request before it's passed to Lambda. This introduces inconsistent event shapes, requiring manual schema tracking per data source.

To avoid this, Direct Lambda Resolvers allow bypassing VTL altogether. With this, AppSync sends a fixed JSON structure to Lambda. However, the current event definitions do not seem to support this pattern explicitly.

The format is described in the official documentation:

https://docs.aws.amazon.com/appsync/latest/devguide/resolver-context-reference.html

Sample Payload

{
  "arguments": { "input": "foo" },
  "identity": {
    "sourceIp": ["x.x.x.x"],
    "userArn": "arn:aws:iam::123456789012:user/appsync",
    "accountId": "666666666666",
    "user": "AIDAAAAAAAAAAAAAAAAAA"
  },
  "info": {
    "fieldName": "greet",
    "parentTypeName": "Query",
    "selectionSetGraphQL": "",
    "selectionSetList": [],
    "variables": {
      "inputVar": "foo"
    }
  },
  "prev": null,
  "request": {
    "headers": {
      "x-api-key": "***",
      "user-agent": "...",
      "...": "..."
    }
  },
  "source": null,
  "stash": {}
}

Setup Steps (Console-based)

To help with future integration testing or reproducibility, here are the steps to configure Direct Lambda Resolvers via the AWS Management Console:

  1. Create a GraphQL API in AppSync

  2. Deploy the target Lambda function

  3. Add a new Data Source with type AWS Lambda

  4. Define the schema, then choose Attach to link a field to the data source

  5. In the "Attach Data Source" screen, select VTL (not AppSync JS!)

  6. After attaching, disable both:

    • "Enable request mapping template"
    • "Enable response mapping template"
  7. Save the resolver

📝 Note:
AppSync JS does not currently support Direct Lambda Resolvers. You must select VTL for this setup to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions