Docs
Launch GraphOS Studio

Updating your graph safely

Upgrade your components in the recommended order to avoid errors


Your consists of multiple components that are each versioned independently:

Your infrastructure
GraphOS
Subgraph A
Subgraph B
Router
🛠
Build
pipeline
  • The router is powered by a particular version of the Apollo Router.
  • The GraphOS build pipeline uses a particular version of Apollo Federation to compose your 's .
    • If you use the Rover CLI to compose your , this is true for as well. In this case, you effectively maintain your own build pipeline.
  • Your subgraph schemas might each use special s that were first introduced in a particular version of Apollo Federation.

These components each target support for a particular version of Apollo Federation, the architecture that underpins every . Because of this, it's important to make sure these various Federation versions remain compatible with each other as you make updates to individual components.

To avoid runtime or composition errors, your 's components should always maintain the following relationship between their targeted Apollo Federation versions:

(Router fed. version) ≥ (Build Pipeline fed. version) ≥ (Subgraph fed. version)

To maintain this relationship, always update these components in order from left to right:

1. Router
2. Build Pipeline
3. Subgraph Schemas

1. Update your router

The method you use to update your depends on which type of you have:

For details on each Apollo version's corresponding Apollo Federation version, see this article.

2. Update your build pipeline

Whenever you make an al change to your graph (such as publishing changes to a subgraph schema), initiates a build that composes your graph's new supergraph . From GraphOS Studio, you can configure which version of Apollo Federation the build pipeline uses to perform this composition.

enables you to choose between minor versions of Federation (such as 2.1). Each option automatically uses the latest supported patch release of that minor version (such as 2.1.4).

Although patch release updates are automatic, you must manually move a graph's build pipeline to a different minor release.

  1. Go to your 's Settings page, then find the General > Build Configuration section.

    Build configuration settings in Studio
  2. Click Edit Configuration. The following dialog appears:

    Build configuration dialog in Studio
  3. Select a Federation version from the Supergraph Pipeline Track dropdown and click Save.

immediately initiates a new build using the selected Federation version, and all future builds also use the selected version.

Composing with the Rover CLI

If you host your own Apollo instance, you can use the Rover CLI to compose its via the rover supergraph compose command.

⚠️ Performing composition with Rover is not recommended. Instead, perform composition via the GraphOS build pipeline to help ensure a consistent delivery process across all of your graph's environments.

If you do perform composition with rover supergraph compose, the command uses the exact version of composition you specify via the federation_version key in the YAML configuration file you pass:

rover supergraph compose --config ./supergraph.yaml
supergraph.yaml
federation_version: =2.3.2
subgraphs:
# ...

This value must target a specific patch release (2.3.1, 2.3.2, etc.), and it must start with an equals sign (=).

⚠️ Important: If you don't provide a value for federation_version, prints a warning and chooses a composition version according to this logic. This is dangerous! might use a newer composition version than what your supports, resulting in a that causes the router to fail on startup.

Learn more about setting a Rover composition version.

3. Update subgraph schemas (as needed)

After both your router and your build pipeline support a particular minimum version of Apollo Federation, your s can use features that were first introduced in that version.

You don't need to update any that doesn't use newly introduced Apollo Federation features. Different s can target different Federation versions as needed. Ultimately, your build pipeline determines which version of composition is actually used to create the .

As an example, the @interfaceObject directive was first introduced in Federation 2.3. To start using this in a , do the following:

  1. Make sure your chosen library has added support for the @interfaceObject by consulting this table.

    • If your library doesn't yet support the , reach out to its maintainers about adding support.
  2. Upgrade to the latest version of your library to make sure you're using a version that supports @interfaceObject.

  3. Modify the following @link in your (or add it if it isn't present yet):

    extend schema
    @link(
    url: "https://specs.apollo.dev/federation/v2.3"
    import: ["@key", "@shareable", "@interfaceObject"]
    )

    Notice that the url targets v2.3 of the Apollo Federation spec, and @interfaceObject is included in the import list.

  4. Apply the @interfaceObject to relevant locations in your .

Because you've already updated your router and build pipeline, the next time you deploy your and publish its to , every component in your will be prepared to interact with a schema that includes the @interfaceObject you've added.

Why is this update order necessary?

s use the Apollo Federation 2 architecture. Federation 2 is itself a versioned technology (2.2, 2.3, etc.), and each version introduces changes and additions to the set of supported subgraph directives.

  • Each version of the Apollo is compiled against a particular version of Federation 2 (for details, see this table). Any given version is backward compatible with previous versions of Federation. However, it isn't compatible with newer versions.

    Therefore, it's important to update your first, before any other component begins using a later Federation 2 version. Otherwise, you might cause your to break by providing it a supergraph that it doesn't support.

  • Your graph's Supergraph Pipeline Track setting in Studio determines which version of Federation 2 is used to compose your . This composition process fails if one of your schemas uses a that was introduced in a Federation version later than your chosen pipeline track.

    • In the case of a failed build, continues to provide your with the from the most recent successful build.
  • Finally, s are where you actually apply new Federation 2 s. You need to update your library to a version that recognizes all directives that you use in your .

    You perform this update last to make sure that every other component of your is prepared to interact with any newly introduced s.

Previous
Local development
Next
Managing graphs in Studio
Edit on GitHubEditForumsDiscord