-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot query both GraphQL and Rest endpoints with variables at same time #280
Comments
This is a high value bug that I've seen symptoms of over the years. My team hasn't been using a hybrid environment yet -- only apollo-link-state and apollo-link-rest so far -- but we're hoping to get to it in January. Do you think you might be interested in helping fix this issue? Hybrid queries are definitely intended to be supported. |
I can see if I can look into this one a bit. I get the feeling this specific one may be a bit complex under the hood. Will likely have a series of questions about it when I get into it, ha. |
We have both graphQl and REST endpoint in our project and I am able to use achieve this using apollo-link-rest library. Basically you need to route your requests based on some context and can split them in httplink depending on that context. |
We have both graphQl and REST endpoint in our project and I am able to use achieve this using apollo-link-rest library. Basically you need to route your requests based on some context and can split them in httplink depending on that context. |
While this does have a workaround (mentioned by @vaibhavcpgeek), I am interested in seeing improvements to the library around this. I do agree it's likely to be a bit complex however! |
Hello all 👋
Currently trying out a hybrid approach against Github's APIs using both their GraphQL and Rest APIs. Attempted to put together a test query to see if I can get this thing working before I start adopting it and ran into an issue in regards to querying both their graphql and rest queries at once. I'm just currently executing this via a Node script.
The following query will result in the error
ApolloError: Variable $repositoryPage is declared by Viewer but not used
:If I instead query
viewer
andrestViewer
fields in separate GraphQL queries, then this error does not occur. I would expect that the act of including a top level GraphQL field would not cause variables only used within rest fields to error out.For reference, here is the client configuration:
For the sake of easily replicating this, I've added a repository that reproduces this: https://github.com/basicdays/ghtest
Notes:
nested
endpoint is a hack to get around issue How to make calls to arbitrary URLs? #192Headers
is an issue in Feature Request: Pluggable 'Headers' API Implementation #279The text was updated successfully, but these errors were encountered: