Using Managed federation in Studio with local development

I am investigating Apollo studio for our use with our federated graph. The fact that we no longer define what the sub-graphs are in our gateway configuration gave me a bit of pause (who moved my cheese?). So I think it’s starting to make sense to me, though I am curious on development flow, especially when working out things locally.

Do I understand this correctly: when I am developing our graph locally, I would use a development variant? Thus it will not affect production or staging ones.

From what I can tell, when using Managed Federation the “development graph” option in studio will not work as that expects a mono-graph (monolithic graph).

Hello! Yes, using a separate variant specifically for your development environment is a great strategy. When you register your subgraph schemas, you can specify localhost routing URLs if those subgraphs will be running on your machine:

rover subgraph publish my-graph@brettski-development --name products --routing-url http://localhost:4001/ --schema ./schema.graphql 

You can then associate your development gateway with your development-specific variant via the APOLLO_GRAPH_REF environment variable, as shown here.

I hope this helps as a start!

hi there, i have set up the ref and key

APOLLO_KEY=<YOUR_GRAPH_API_KEY> #insert my key
APOLLO_GRAPH_REF=<YOUR_GRAPH_ID>@<VARIANT> #insert my ref 

and I am receiving this error when I start the gateway up locally:

Starting Apollo Gateway in managed mode ...
Error: UNKNOWN_REF: No valid graph configuration for graphID: fake-graph-1234, variant: current. Ensure that the correct graph id and variant are being provided.
1 Like