Allow AppSync JavaScript resolvers to return arrays of operations for parallel execution (implicit fan-out) #401
jay-herrera
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal: Allow AppSync JavaScript resolvers to return arrays of operations for parallel execution (implicit fan-out)
Summary
This proposal suggests extending AppSync JavaScript resolvers so that if a request function returns an array of operation objects, AppSync executes those operations in parallel against the configured data source and returns an array of results to the response function.
This enables safe, bounded fan-out patterns natively within resolvers — eliminating the need for Lambda orchestration or multiple pipeline steps — while staying consistent with AppSync’s current execution and cost model.
Motivation
Currently, each AppSync resolver can only perform one operation per data source invocation.
If a developer needs to query or mutate multiple items (for example,
GetItemfor a list of IDs), they must either:Allowing parallel execution of multiple operations within a single JS resolver would:
Proposed Design
Example
Behavior
Behavior
If the
requestfunction returns an array:responsefunction asctx.resultIf the
requestfunction returns a single object:Error Handling
nullinctx.resultctx.resultErrorsarrayBatchGetItemare acceptableImplementation Constraints
Benefits
Array.isArray(requestResult)is trueAlternatives Considered
BatchGetItem/TransactWriteItems: limited to DynamoDB, less flexibleExample Use Cases
Multi-key lookups
Batch writes
Dynamic fan-out pipelines
Closing
This proposal introduces a small, backwards-compatible enhancement that makes AppSync resolvers dramatically more expressive while maintaining deterministic and serverless characteristics.
It aligns with AppSync’s direction toward JavaScript-based resolvers and could serve as a foundation for future dynamic features such as conditional branching or sequential looping.
Beta Was this translation helpful? Give feedback.
All reactions