I'm doing an application in AppSync and I'm trying to create with Cloud Formation one schema where one mutation is linked to one resolver and a second mutation is linked to a second resolver. But it always give me an error saying that I can't attach two mutations in a single request.
If I try to do in console, I can attach two mutations in two resolvers.
Someone has any idea how I can provision everything in Cloud Formation ?
[EDIT] I added this resolver to the template
AppSyncMutationResolverOne:
Type: "AWS::AppSync::Resolver"
DependsOn: AppSyncSchema
Properties:
ApiId: !Ref GraphApiId
TypeName: Mutation
FieldName: exampleOne
DataSourceName: !GetAtt DataSourceOne.example
RequestMappingTemplate: !Ref RequestMappingTemplate
ResponseMappingTemplate: !Ref ResponseRequestMappingTemplate
But when I try to add a second Mutation Resolver, pretty similar with this first one
AppSyncMutationResolverTwo:
Type: "AWS::AppSync::Resolver"
DependsOn: AppSyncSchema
Properties:
ApiId: !Ref GraphApiId
TypeName: Mutation
FieldName: exampleTwo
DataSourceName: !GetAtt DataSourceTwo.example
RequestMappingTemplate: !Ref RequestMappingTemplate
ResponseMappingTemplate: !Ref ResponseRequestMappingTemplate
It returns me an error saying that I can't add two mutation resolvers to the same API
This is my RequestMappingTemplate that is used for both mutations:
{
"version": "2017-02-28",
"operation": "Invoke",
"payload": {
"arguments": $utils.toJson($context.arguments)
}
}