Error: Only one resolver is allowed per field
See original GitHub issueThe following GraphQL-Schema leads to the Error “Only one resolver is allowed per field” when pushed to the AWS Cloud.
type TypeA @model {
id: ID!
typeB: [TypeB!]! @connection(name: "myCon")
}
type TypeB @model {
id: ID!
typeA: TypeA! @connection(name: "myCon")
}
The generated Resolver and CloudFormation looks good to me. The Resolvers seems to be unique per Type and Field.
We had to rename the non-collection property to something else so the resolver could be deployed:
type TypeA @model {
id: ID!
typeB: [TypeB!]! @connection(name: "myCon")
}
type TypeB @model {
id: ID!
typeBTypeA: TypeA! @connection(name: "myCon")
}
I don’t know if this is a CloudFormation or a Amplify CLI Bug. There is a Forum Post (https://forums.aws.amazon.com/thread.jspa?messageID=884492󗼌) which I replied to because this can be that CloudFormation Bug. But since I use the Amplify CLI, I wanted to bring this up, even if it’s just for documentation.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:24
- Comments:47 (5 by maintainers)
Top Results From Across the Web
Changing logical ID of AppSync resolver result in error upon ...
Only one resolver is allowed per field. (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: ...
Read more >Possible to override default GraphQL @model resolvers with ...
I'm hoping to leverage a GraphQL model managed by Amplify / AppSync and build on that ... Event Type: create Reason: Only one...
Read more >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 >API (GraphQL) - Overwrite & customize resolvers - Amplify Docs
GraphQL resolvers connect the fields in a type's schema to a data source. ... business logic you can just as easily call out...
Read more >Resolver mapping template reference for Lambda
The Lambda request mapping template is fairly simple and allows as much context ... You can return an error for all results by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It seems there is some path that leaves APIs in a state where a resolver is left dangling even after the field is removed from the schema. When this happens you can get around the issue by going to the AppSync console, adding a field to the schema with the same name as the supposed conflict, delete the resolver record by selecting it from the right half of the schema page and clicking “Delete Resolver” on the resolver page.
I will try to reproduce and identify the underlying issue but it appears that it is not within the Amplify CLI itself.
I found a solution for this error without losing the data.
Do the following actions for the affected types:
type Name @model(queries: null, mutations: null, subscriptions: null) {...}amplify pushtype Name @model {...}amplify pushGood luck!