question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-appsync): resolver replacement issues

See original GitHub issue

There seem to be issues when that come up during appsync deployment when resolvers for specific fields are replaced. If you change the uniqueID of a resolver, this will cause a CFN deployment where the old resolver is removed, and the new one is created. Since only one resolver can exist on a field, this will cause the deployment to fail with Only one resolver is allowed per field.

Alternatively, this can also result in ‘detached’ resolvers, which are not actually triggered on their corresponding queries.

This may require resolution on the cloudformation or appsync side since the changes being submitted by the CDK are valid and replacing existing resolvers is allowed, though obviously could incur some downtime.

See: https://github.com/aws/aws-cdk/issues/13238 and https://github.com/aws/aws-cdk/issues/12635 for relevant details.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:26 (9 by maintainers)

github_iconTop GitHub Comments

16reactions
Dachmiancommented, Jun 11, 2021

Is this being worked on actively by the Appsync/Cloudformation team?

The CFN error only one resolver is allowed per field has been reported on various forums, posts etc all the way back to 2018 and its seems like there is complete silence from the Appsync/Cloudformation team on why this is happening and the only things you can find are various people suggesting different workarounds with renaming resources etc.

Can we have an official statement of what is causing the issue and an ETA on a fix? OR if this is user error please explain the correct way to update/replace resolvers and datasources.

10reactions
mmccall10commented, Jul 5, 2021

@pszabop this is my experience too. I can reliably reproduce the error by first creating the resolver FROM the data source then attempting to change the data source type. Creating the resolver against the data source results in the inability to update it. You’ll need to delete the resolver then re-create it. Does not go over well in production. In my experience to avoid this undesired behavior DO NOT create the resolver from the data source, create it from the appsync api.

const graphqlApi = new GraphqlApi(...);
const demoDS = api.addDynamoDbDataSource(...);

// Do this
graphqlApi.createResolver(...)

//Not this
demoDS.createResolver(...)

https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-appsync.GraphqlApi.html#createwbrresolverpropsspan-classapi-icon-api-icon-experimental-titlethis-api-element-is-experimental-it-may-change-without-noticespan

https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-appsync.CfnResolver.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::AppSync::Resolver - AWS CloudFormation
The AWS::AppSync::Resolver resource defines the logical GraphQL resolver that you attach to fields in a schema. Request and response templates for resolvers ......
Read more >
Conflict Detection and Sync - AWS AppSync
RESOLVE : Replace the existing item with new item supplied in response payload. You can only retry the same operation on a single...
Read more >
Troubleshooting and Common Mistakes - AWS AppSync
This section discusses some common errors and how to troubleshoot them. Incorrect DynamoDB Key Mapping. If your GraphQL operation returns the following ...
Read more >
Resolver mapping template programming guide - AWS AppSync
AWS AppSync uses VTL to translate GraphQL requests from clients into a request to your data source. Then it reverses the process to...
Read more >
JavaScript resolvers overview - AWS AppSync
AWS AppSync lets you respond to GraphQL requests by performing operations on your data sources. For each GraphQL field you wish to run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found