router icon indicating copy to clipboard operation
router copied to clipboard

query batching

Open sjungling opened this issue 3 years ago • 6 comments

Describe the bug In our project we use BatchHttpLink. When attempting to run against router, an error is thrown

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/sjungling/apollo-router-batch
  2. Checkout the broken branch
  3. Run yarn install
  4. Run yarn start:router
  5. Run yarn start
  6. Navigate to http://localhost:3000 and observe an error in the terminal for router (see Outputs below)
  7. (Optional) Checkout main branch and refresh the browser where you can observe the query succeeded.

Expected behavior I would assume a successful query response.

Output

Nov 10 21:05:43.343 DEBUG hyper::proto::h1::conn: incoming body is content-length (104 bytes)
Nov 10 21:05:43.343 DEBUG hyper::proto::h1::conn: incoming body completed
Nov 10 21:05:43.343 DEBUG warp::filters::body: request json body error: invalid type: map, expected a string at line 1 column 1
Nov 10 21:05:43.343 DEBUG warp::filter::service: rejected: Rejection([BodyDeserializeError { cause: Error("invalid type: map, expected a string", line: 1, column: 1) }, MethodNotAllowed])

Desktop (please complete the following information):

  • OS: MacOS
  • Version 12.0.1
  • Apollo Client 3.4.17
  • Router v0.1.0-alpha.0

Additional context Delta between two branches in sample repo

sjungling avatar Nov 11 '21 05:11 sjungling

Hi!

Thank you for submitting this issue, and especially for providing us with very clear instructions on how to reproduce the behavior!

The query that is sent is effectively part of a batch:

[{"operationName":"test","variables":{},"query":"query test {\n  me {\n    id\n    __typename\n  }\n}"}]

It is indeed not supported yet. Let's get back to you once we have a roadmap available, and hopefully an ETA on query batching support.

o0Ignition0o avatar Nov 12 '21 13:11 o0Ignition0o

@o0Ignition0o Please can you help us with ETA for the query batching support in the road map

saravind-hotstar avatar Jun 14 '22 16:06 saravind-hotstar

Also interested in understanding the timeline for batching support

andrew-kolesnikov avatar Jun 30 '22 23:06 andrew-kolesnikov

it is not in the roadmap for now, we will come back with an update once it is there

Geal avatar Jul 01 '22 08:07 Geal

@Geal Any update on the same, most of the clients are using batched requests, with this migration to rust would be tougher

saravind-hotstar avatar Aug 26 '22 13:08 saravind-hotstar

Hi @Geal @o0Ignition0o any updates wrt. the batching support? If not already in the roadmap, could one of you guide us towards contributing this feature?

vamsi360 avatar Sep 01 '22 14:09 vamsi360

any updates on this?

claygorman avatar Jan 24 '23 22:01 claygorman

Addition of this feature would be much appreciated.
On a different note: A hint in the Router docs stating that this (kind of established) functionality is currently not available.
Proper error messages in the Router logs would also be nice instead of a deserialization error

mxcd avatar Feb 22 '23 21:02 mxcd

created this draft PR https://github.expedia.biz/weaver/weaver-loom-router/pull/39

to add support for batching at router_service layer.

samuelAndalon avatar Apr 03 '23 17:04 samuelAndalon

Curious as to when support for batching will be available. Any update on this would be really appreciated!

rickbijkerk avatar May 04 '23 07:05 rickbijkerk

For link-ability, this issue is tracking support of accepting an array of GraphQL requests in the HTTP body from the client to the Router.

We have another issue for making batched requests from Router to subgraphs

smyrick avatar Jun 27 '23 21:06 smyrick