Description
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:
-
Create a GraphQL API in AppSync
-
Deploy the target Lambda function
-
Add a new Data Source with type AWS Lambda
-
Define the schema, then choose Attach to link a field to the data source
-
In the "Attach Data Source" screen, select VTL (not AppSync JS!)
-
After attaching, disable both:
- "Enable request mapping template"
- "Enable response mapping template"
-
Save the resolver
📝 Note:
AppSync JS does not currently support Direct Lambda Resolvers. You must select VTL for this setup to work.