Closed ghost closed 5 years ago
actually it does not even take the name for request template. I think it is taking the template names from fieldname parameter.
This is fixed by https://github.com/aws-amplify/amplify-cli/pull/2355
The problem still exists. Failed to start API Mock endpoint Error: Invalid config for UNIT_RESOLVER {"dataSourceName":"TodoTable","typeName":"Query","fieldName":"scanTodos","requestMappingTemplateLocation":"resolvers/Query.scanTodos.req.vtl","responseMappingTemplateLocation":"resolvers/Query.scanTodos.res.vtl","kind":"UNIT"} Missing mapping template resolvers/Query.scanTodos.req.vtl
running npm install -g @aws-amplify/cli
to upgrade to the newest version fixed this for me. i am on windows and this patch fixed my issue: https://github.com/aws-amplify/amplify-cli/commit/87c4ad59a701995220946ad35f1491f0d4b57325
thank you team
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
Describe the bug When custom resolver response templates have been defined with a non-standard name, even though those names are defined in the resolver CloudFormation template, these names are not used. Instead the local mocking code looks for a response template with the same name as the request template, but with
.res.vtl
extension.Note that the same setup works fine non-locally after an
amplify push
To Reproduce Create a custom resolver for a mutation eg.
Mutation.createBodyBlock
.<api>/resolvers/Mutation.createBodyBlock.req.vtl
.<api>/resolvers/passthrough.res.vtl
stacks/CustomResources.json
which specifies the above two locations for the Request and Response portions of the resolver:amplify mock api
Expected behavior It should use the name provided in the stack for the response template, and not assume that it's the same as the request template with a different suffix.