amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

amplify mock not working

Open vasujogani opened this issue 5 years ago • 17 comments

Note: If your question is regarding the AWS Amplify Console service, please log it in the official AWS Amplify Console forum

Which Category is your question related to? Mocking and Testing

Amplify CLI Version 4.20.0

What AWS Services are you utilizing? Graphql, Elasticsearch (via @searchable)

Provide additional details e.g. code snippets amplify mock

amplify mock fails

Mock does not handle CloudFormation resource of type AWS::Elasticsearch::Domain. Skipping processing resource ElasticSearchDomain. 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 Error: Could not get resource ElasticSearchDomain

How can I bypass this?

Thanks

vasujogani avatar May 20 '20 03:05 vasujogani

Interested in this. I started getting 404 on a previously running react page yesterday.

weisisheng avatar May 20 '20 05:05 weisisheng

@SwaySway any way to temporarily bypass this for now?

vasujogani avatar May 22 '20 20:05 vasujogani

The CLI does not support mocking of searchable. A potential workaround for this would be to comment out searchable before running amplify mock. As a takeaway action we can look into how we can still provide mock functionality.

SwaySway avatar May 22 '20 22:05 SwaySway

+1 Commenting out searchable is not a great answer.

Update: Great news! We moved off Amplify and now no longer needs this. 😅

TheBox193 avatar Jun 09 '20 18:06 TheBox193

+1

dtelaroli avatar Jun 17 '20 01:06 dtelaroli

The CLI does not support mocking of searchable. A potential workaround for this would be to comment out searchable before running amplify mock. As a takeaway action we can look into how we can still provide mock functionality. @SwaySway Why did the amplify cli regress on this? version 4.12.0 of the amplify cli supports mocking ElasticSearchDomain.

chrisw-asu avatar Jul 06 '20 11:07 chrisw-asu

It is totally not cool to break old functionality in your product when releasing new versions of it. This should really eliminate amplify cli from being considered for any applications uses.

chrisw-asu avatar Jul 06 '20 11:07 chrisw-asu

Mocking of APIs breaks out of the box for the Todo app. Mocking of Lambdas breaks out of the box on the Hello World function. Does anyone even build this?

seanchatman avatar Jul 20 '20 20:07 seanchatman

+1

mikerudge avatar Jul 22 '20 07:07 mikerudge

+1 Any word on this? I'd really like to be able to launch graphiQL for the bulk of my local testing even if I have to stay away from search-related resolvers. Until then, I'm relegated to e2e testing direct with backend.

kevcam4891 avatar Aug 28 '20 14:08 kevcam4891

My mock fails on @function annotation of mutation. any planned fixes for this?

tomyitav avatar Nov 02 '20 13:11 tomyitav

We're starting to feel the issue of not having local mocking that supports all the features we're using in amplify. When we onboard new developers they make frequent changes (especially to the schema) as they learn the project. Making frequent changes that require deployments slows them down quite a bit. I hope mock can catch up to more of the common features used in amplify projects.

kldeb avatar Jan 23 '21 16:01 kldeb

How about amplify mockcreates a copy of the schema and comments out the @searchable directives for me? That way I don't accidentally drop it in production when i yolo push my app.

kldeb avatar Feb 12 '21 21:02 kldeb

Another solution we're considering is removing @searchable from our schema and getting by with @keys. We don't think our users will notice since search is limited to a few fields.

kldeb avatar Apr 20 '21 13:04 kldeb

Hi folks - we're planning on addressing this as part of our new GraphQL transformer. The approach is captured here in our RFC: https://github.com/aws-amplify/amplify-cli/issues/7546 love to hear your feedback!

renebrandel avatar Jun 22 '21 16:06 renebrandel

any news?

MontoyaAndres avatar Sep 08 '21 13:09 MontoyaAndres

Or plans, estimates, when it could be released ?

majirosstefan avatar Oct 25 '21 13:10 majirosstefan