aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.13k forks source link

Batch GraphQL Queries #3107

Closed EgidioCaprino closed 5 years ago

EgidioCaprino commented 5 years ago

Which Category is your question related to? GraphQL API

What AWS Services are you utilizing? Cognito and AppSync

Provide additional details e.g. code snippets The Apollo client provides a shouldBatch option to batch query operations so that multiple queries will be sent in a single network roundtrip. Is there a way to set Amplify in order to use the same functionality?

evelant commented 5 years ago

There is a batchinvoke function for lambda resolvers, I'm not sure about others

https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html

Unfortunately it looks like it is severely limited. There is an undocumented limitation that it will only invoke batches of 5 so it doesn't really do much to help in a lot of situations. Unfortunately that doesn't looks like it is going to change either, it has been 15 months since AWS said they are looking into it but the thread has gone dead with no responses about it.

https://forums.aws.amazon.com/thread.jspa?threadID=270548&tstart=0

EgidioCaprino commented 5 years ago

@AndrewMorsillo thank you for your answer. Just to be sure, I'm talking about a client-side feature that will fire subsequent GraphQL queries in a single network request.

undefobj commented 5 years ago

@EgidioCaprino query batching is a feature that AppSync doesn't support at this time as it is not part of the GraphQL specification. I would suggest opening a feature request in the AppSync forum or on the community page to gauge interest from the larger ecosystem: https://github.com/aws/aws-appsync-community

janhesters commented 5 years ago

@EgidioCaprino Stumbled upon this issue. If you'd like to know how to batch create or delete up to 25 items simultaneously check out this tutorial that I wrote. I hope it might help you.

github-actions[bot] commented 3 years ago

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 or Discussions for those types of questions.