amplify-cli: Fails to start api mock w/unhelpful error message
Describe the bug When trying to run a local mock of an API that is successfully deployed to the cloud using cli version 3.15.0, I get the following error:
Scanning for plugins...
Plugin scan successful
The following types do not have '@auth' enabled. Consider using @auth with @model
[redacted]
Learn more about @auth here: https://aws-amplify.github.io/docs/cli-toolchain/graphql#auth
GraphQL schema compiled successfully.
Edit your schema at /[…]amplify/backend/api/[…]/schema.graphql or place .graphql files in a directory at /[…]amplify/backend/api/[…]/schema
Data source of type AMAZON_ELASTICSEARCH is not supported by local mocking. A NONE data source will be used.
Failed to start API Mock endpoint TypeError: Cannot read property 'name' of undefined
Desktop (please complete the following information):
- OS: macOS 10.15.1
- CLI Tools v3.15.0
- Node v10.16.3
Additional context My schema is fairly complex, comprising 30-some different data sources, custom resolvers and so on. I can push to AWS no problem, so not an enormous deal, but would be nice to have local mocking capability for testing our custom resolvers.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (13 by maintainers)
Having the same issue here and been waiting for it for a long time now. Also, is the
enhancementlabel correct here? Shouldn’t it be a bug since it causes mock to fail?we could definately improve this and add support for all query/mutations except for the
search*queries. Let me mark this as enhancement for mock@nagey fwiw i got the error
Failed to start API Mock endpoint TypeError: Cannot read property 'name' of undefinedwhen runningamplify mockas well. Turned out my (manually built) stack needed to have things defined in a specific order within the json files – specifically my data sources needed to come before any resolvers or functions that might reference them.