apollographql / rover

The CLI for Apollo GraphOS
https://rover.apollo.dev
Other
408 stars 85 forks source link

feat: add `--header/H` to `rover dev` for introspection requests #1474

Open EverlastingBugstopper opened 1 year ago

EverlastingBugstopper commented 1 year ago

some subgraphs require authentication before they will respond to introspection queries. rover graph introspect and rover subgraph introspect both allow multiple --header/-H arguments to be passed. We should provide that same functionality for rover dev whenever a --url is passed and a --schema is not passed. we should use clap to make the schema and header arguments mutually exclusive.

mvrahden commented 1 year ago

Additionally it would be nice to have this for the rover supergraph compose command, to add a header for introspection requests.

noamski commented 1 year ago

Additionally it would be nice to have this for the rover supergraph compose command, to add a header for introspection requests.

Is there any progress with this? seems weird that rover subgraph introspect is able to get --header but supergraph compose can't

nimhawk commented 1 year ago

This would help us out too for local development. Right now we have to run two rover dev commands and generate a "throw away" schema file to add a new subgraph to the dev session.

platzhersh commented 1 year ago

Same request here. It feels a bit inconsistent atm. Would also be nice to have the header options for the supergraph compose config yaml.

dbanty commented 1 year ago

You can use introspection_headers for rover supergraph compose and you can now use that same supergraph.yaml file with introspection_headers for rover dev to get the same behavior.

This is a different mode of rover dev that connects multiple subgraphs at once, so I think we still want the --header option for single-subgraph sessions, but the supergraph method does function as a workaround for now.

MajcenT commented 1 year ago

You can use introspection_headers for rover supergraph compose and you can now use that same supergraph.yaml file with introspection_headers for rover dev to get the same behavior.

This is a different mode of rover dev that connects multiple subgraphs at once, so I think we still want the --header option for single-subgraph sessions, but the supergraph method does function as a workaround for now.

Hello! I have protected each of my subgraphs with different router password and now I would like to update my supergraph-config.yaml file to be able to introspect protected subgaraphs by setting headers based on your suggestion, when running rover supergraph compose

I was trying to do something like this:

image

I have even tried giving the header name "Authorization" but unfortunately that didn't work either. Is there something wrong in the sample I have provided?