-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Gateway should offer configuration point for introspection query #2891
Comments
Made a quick demo implementation, we can discuss API in this thread. |
I just ran into this issue today (my service requires a particular header), FWIW it would be nice to be able to manipulate headers on a per-service basis rather than just globally. Perhaps as a |
This would be quite helpful, but I also see it as useful for us to possibly configure the actual method used to communicate with the service. One might want to use I have patched the Apollo Gateway in my own codebase to facilitate my desire for leveraging |
Hey @JacksonKearl thanks for making those changes. Is there any documentation for this yet? Also, is my understanding correct that you would be sending the same headers for all introspection queries? In our use case we would want to send different headers to each service, or in some cases, the same headers but different values. Is there a way of doing that? |
Hey @jaknor, no docs yet. And still open to changes on the interface, what would you like to be able to do? For instance, would |
To confirm, would the headers then only be applied for the specified url? That should work for this particular use case. Thinking a little more about it we have also looked at using IAM authentication for our AWS API gateway. this however requires that you sign the request which in turn requires access to the request uri, body, headers etc. In schema stitching we were able to achieve this using a custom fetch method on the HttpLink object. This also had the added benefit that the same HttpLink was used for both introspection and regular requests so we only had to specify our custom logic once. Without having looked too much into the code it appears that the willSendRequest method on a RemoteGraphQLDataSource would be a good place for the logic, however, this does not appear to be used for introspection. Is there a reason for this? At the moment I can't think of a reason why I would want my introspection request to be treated differently from other requests but I am probably missing some context. If we don't want to use the RemoteGraphQLDataSource for the introspection I think it would be good to have a method similar to willSendRequest available for introspection but it would have to be per service. I am also thinking that the managed federation announced yesterday might solve this as we would not be introspecting to get the schema, we would be querying engine, however I am not convinced I would want to use this approach during development but rather just introspect to keep things simple. I need to look into how it all works a bit more before making my mind up on that one though. |
I also have need to enhance the request beyond just modifying headers. In my case I need to add request parameters to the URL for some federated services. I also think that I just submitted a PR that uses |
Closed by #3120 |
Gateways currently offer a configuration point for
buildService
->willSendRequest
, which allows setting headers on normal federated requests to their services, but they offer no configuration hook for sending the initialquery GetServiceDefinition { _service { sdl } }
request.https://spectrum.chat/apollo/apollo-federation/sending-authorization-header-on-gateway-introspection-query~e8c3c16a-07b7-464a-97f5-13f577591bb9
The text was updated successfully, but these errors were encountered: