aws / aws/aws-appsync-community

Feature Request: Per request resolver/pipline resolver to set the default stash value

Open
#9 8 comments 10 reactions 0 assignees View on GitHub
feature-request
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

I'd like to propose adding a resolver/pipeline resolver that is triggered once per request. The return value from this resolver would become the initial value of the stash for each GraphQL resolver instead of it being empty.

Use case: When the user sends a request I want to lookup tenant/permission information once and have it available in all resolvers.

Current options:

1. Use resolver pipelines/functions and repeat the same lookup in every resolver. This wastes time and dynamodb capacity repeating the same query.

2. Use the Pre Token Generation trigger on the Cognito User Pool to customize the identity token. This has some negative side effects and isn't support by Amplify which send the access token (see https://github.com/aws-amplify/amplify-js/issues/1772).

By providing a way to set the default value for the stash from a resolver/pipeline resolver that is executed once I can efficiently lookup information required by all (or at least most) resolvers.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the request's GraphQL resolver and pipeline-resolver flow, including how the stash is initialized and how resolver pipelines/functions currently repeat lookups. Done would mean establishing whether a once-per-request resolver can provide the initial stash value for subsequent resolvers, while preserving the tenant and permission lookup use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.