Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround for AppSync 'design flaw' which loses resolvers #51

Merged
merged 1 commit into from
Apr 15, 2021

Conversation

twrichards
Copy link
Collaborator

@twrichards twrichards commented Apr 15, 2021

* resolver = the code that maps requests/responses for the a datasource (such as DynamoDB) from/to the GraphQL payloads.

For a while now we've been observing 'AppSync resolvers' occasionally getting disconnected when cloudforming (following changes to the GraphQL schema). This has been raised by others in aws/aws-appsync-community#146, apparently this is 'by design' according to aws/aws-appsync-community#146 (comment), some argue it's a bug others have called this a 'design flaw', but whatever it's called it's super annoying, as it causes pretty much all of pinboard to break 👿 (and requires us to manually re-add the resolvers).

What does this change?

This PR aims to workaround this problem by including an md5 checksum of the GraphQL Schema as a comment in all of the resolvers, somewhat inspired by sid88in/serverless-appsync-plugin#225 (comment) (but unlike that suggestion our solution won't cause cloudformation step for every deploy, as we don't change the schema that often).

How to test

Deploy this branch to CODE, in the AWS Console, when looking at pinboard-appsync-api-CODE in the AppSync area, look inside the Schema section and scroll down the resolvers on the right to find the Query and Mutation sections...
image
... clicking any of those links should take you to the corresponding resolver, for each either the request/response template should include a comment like...
image

How can we measure success?

More stability when releasing 🙏

@twrichards twrichards force-pushed the appsync-resolver-bug-workaround branch from bac6a82 to 306f878 Compare April 15, 2021 09:34
@twrichards twrichards force-pushed the appsync-resolver-bug-workaround branch from 306f878 to 9c233e6 Compare April 15, 2021 09:38
@twrichards
Copy link
Collaborator Author

twrichards commented Apr 15, 2021

@twrichards twrichards requested review from tjsilver and a team April 15, 2021 09:54
@twrichards twrichards changed the title add checksum of schema as a comment on all resolvers* as a workaround for AppSync 'design flaw' workaround for AppSync 'design flaw' which loses resolvers Apr 15, 2021
Copy link
Contributor

@tjsilver tjsilver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Tested in CODE/AWS and works as described.

@twrichards twrichards merged commit 338d046 into main Apr 15, 2021
@twrichards twrichards deleted the appsync-resolver-bug-workaround branch April 15, 2021 16:09
@prout-bot
Copy link
Collaborator

Seen on PROD (merged by @twrichards 4 minutes and 20 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants