rover subgraph publish: Publish a Federated Subgraph
rover subgraph publish sends a subgraph schema and routing URL to GraphOS, which recomposes the supergraph and reports any composition errors.
In Apollo Federation, each service publishes its subgraph after merge so the gateway/router picks up the new supergraph. This command is the deploy step of the GraphOS workflow.
What it does
rover subgraph publish takes a graph ref, a subgraph --name, its --routing-url, and the schema, then registers it with GraphOS. GraphOS recomposes the supergraph from all subgraphs and returns composition success or the errors that block it.
Common usage
export APOLLO_KEY=service:my-graph:xxxxxxxx
rover subgraph publish my-graph@current \
--name products \
--routing-url https://products.svc.example.com/graphql \
--schema ./products.graphqlOptions
| Flag / Env | What it does |
|---|---|
| <GRAPH_REF> | Graph and variant to publish into |
| --name <name> | Subgraph name (required) |
| --routing-url <url> | Where the router should route this subgraph |
| --schema <path|-> | Subgraph schema file or - for stdin |
| --convert | Convert a non-federated schema on first publish |
| APOLLO_KEY | GraphOS API key for authentication |
In CI
Publish only on the deploy/merge job, not on PRs (use rover subgraph check on PRs). Set --routing-url to the environment being deployed so the router routes correctly. Treat composition errors in the publish output as a failed deploy.
Common errors in CI
Composition failures print error[COMPOSITION_ERROR] lines such as Field "Product.price" ... type mismatch and the publish is rejected. "No credentials found. Rover requires an API key ... APOLLO_KEY" means the secret is unset. "The subgraph ... routing URL is required" means --routing-url was omitted on first publish. A WARN about an unchanged schema is informational, not a failure.