router
router copied to clipboard
query batching
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:
- Clone https://github.com/sjungling/apollo-router-batch
- Checkout the
broken
branch - Run
yarn install
- Run
yarn start:router
- Run
yarn start
- Navigate to http://localhost:3000 and observe an error in the terminal for
router
(see Outputs below) - (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
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 Please can you help us with ETA for the query batching support in the road map
Also interested in understanding the timeline for batching support
it is not in the roadmap for now, we will come back with an update once it is there
@Geal Any update on the same, most of the clients are using batched requests, with this migration to rust would be tougher
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?
any updates on this?
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
created this draft PR https://github.expedia.biz/weaver/weaver-loom-router/pull/39
to add support for batching at router_service layer.
Curious as to when support for batching will be available. Any update on this would be really appreciated!
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