- Updated dependencies [
345661c558773e4eb5d5f0b28464a8d1acdc2a2d
,7fe1465cf35c2efe37ac5c73fac2b7ea04173318
,cc4573471696ef78d04fa00c4cf8e5c50314ba9f
,062572b3253e8640b60a0bf58b83945094b76b6f
,df5eb3cb0e2b4802fcd425ab9c23714de2707db3
,1c99cb0dcc6c639ac351210932623ab0bd6907e4
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
2192f355f50db33fe0807d16153f357696b9f190
,e1e2605b30efc488b57f62ba43436606a38a3607
,5ac01b534318105e904c1e6598070f753add3bb1
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Fix bugs in composition when merging nulls in directive applications and when handling renames. (#3134)
-
Updated dependencies [
b8e4ab5352a4dfd262af49493fdd42e86e5e3d99
,e6c05b6c96023aa3dec79889431f8217fcb3806d
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Avoid type explosion for inline fragments where the type condition is an interface that implements the parent type. (#3122)
-
Reduce memory overhead during satisfiability checking when there are many options. (#3109)
-
Updated dependencies [
02c2a34a62c3717a4885449172e404f19ebf66c9
,0ccfd937d4b4a576f890665ceebbd7986fac5d0c
,e0a5075c0d12a0e2f7ef303b246e3216a139d3e0
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
Correct a bug where complex queries can cause uncontrolled recursion due to failure to reduce the number of possible query plans (classified as CWE-674). (#3128)
This weakness impacts all v2 versions of @apollo/gateway
prior to this release. See the associated Github Advisory, GHSA-fmj9-77q8-g6c4, for more information.
- Updated dependencies [
926cbb7949200e12b81100a07fa3438b5ae9efd0
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
4d9e0f6390c5114132d205ab73b6aa1b9ffa8cd8
,5f4bb160d024678d6facd471c43c8ec61c86e701
,672aca7cbeb0a6a38586357a4e154f2dd91caa0c
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
38debcf2f9af1a719bd1c8acbd9335efa8427ddb
,50d648ccffb05591878de75dc5522914ed48698f
,860aace9904e787f9bf05aad94be5b5920f10543
,67b70c6e68b1cdbf8f03dacafd636e27ed9b7814
,f753d55e9a49d11389ee4f8d7976533447e95ede
,f5f6a799d6b3675eecb0eaec7a816d746cd136b2
,42bd27af6a23bcfdd36951dbfa3fb9f7ba833f3a
,f376447a820e3c0ae41d16d1fd3b681d2f1e8c14
,3af790517d662f3bec9064c0bf243014c579e9cd
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
50d648ccffb05591878de75dc5522914ed48698f
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
f376447a820e3c0ae41d16d1fd3b681d2f1e8c14
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
38debcf2f9af1a719bd1c8acbd9335efa8427ddb
,860aace9904e787f9bf05aad94be5b5920f10543
,67b70c6e68b1cdbf8f03dacafd636e27ed9b7814
,f753d55e9a49d11389ee4f8d7976533447e95ede
,f5f6a799d6b3675eecb0eaec7a816d746cd136b2
,42bd27af6a23bcfdd36951dbfa3fb9f7ba833f3a
,3af790517d662f3bec9064c0bf243014c579e9cd
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
b2e5ab66f84688ec304cfcf2c6f749c86aded549
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
61f2b6b12ee83e7ecb6509f7131f9412a37e194b
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Implement new directives to allow getting and setting context. This allows resolvers to reference and access data referenced by entities that exist in the GraphPath that was used to access the field. The following example demonstrates the ability to access the
prop
field within the Child resolver. (#2988)type Query { p: Parent! } type Parent @key(fields: "id") @context(name: "context") { id: ID! child: Child! prop: String! } type Child @key(fields: "id") { id: ID! b: String! field(a: String @fromContext(field: "$context { prop }")): Int! }
-
Various set context bugfixes (#3017)
-
Updated dependencies [
c4744da360235d8bb8270ea048f0e0fa5d03be1e
,8a936d741a0c05835ff2533714cf330d18209179
,daf36bd242ba4db0cfcf0e18c1eed235ff0dfaf2
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies []:
- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Implement new directives to allow getting and setting context. This allows resolvers to reference and access data referenced by entities that exist in the GraphPath that was used to access the field. The following example demonstrates the ability to access the
prop
field within the Child resolver. (#2988)type Query { p: Parent! } type Parent @key(fields: "id") @context(name: "context") { id: ID! child: Child! prop: String! } type Child @key(fields: "id") { id: ID! b: String! field(a: String @fromContext(field: "$context { prop }")): Int! }
- Updated dependencies [
c4744da360235d8bb8270ea048f0e0fa5d03be1e
,daf36bd242ba4db0cfcf0e18c1eed235ff0dfaf2
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Triggering a clean 2.7.8 release now that harmonizer build has been fixed. (#3010)
-
Updated dependencies [
2ad72802044310a528e8944f4538efe519424504
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
No logical changes since 2.7.5 or 2.7.6, but we fixed a bug in the release process, so we need to publish a new patch version (2.7.7). (#2999)
-
Updated dependencies [
bee0b0828b4fb6a1d3172ac330560e2ab6c046bb
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
856a82b1deca625b75145edd6328bed23abee33a
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
af4376f348d21ad4d8eca0e3d2a170600f391e4d
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
d80b7f0ca1456567a0866a32d2b2abf940598f77
,c89d8287e88d12cfd34c1baf1f42db672731b8a7
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
ec04c50b4fb832bfd281ecf9c0c2dd7656431b96
,3e2c845c74407a136b9e0066e44c1ad1467d3013
,a494631918156f0431ceace74281c076cf1d5d51
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Remove out-of-band reporting in the gateway and provide a warning for users who have the endpoint configured. (#2946)
-
Updated dependencies [
33b937b18d3c7ca6af14b904696b536399e597d1
,09cd3e55e810ee513127b7440f5b11af7540c9b0
,d7189a86c27891af408d3d0184db6133d3342967
,33506bef6d755c58400081824167711c1747ee40
,1f72f2a361a83ebaaf15ae052f5ca9a93fc18bfc
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
493f5acd16ad92adf99c963659cd40dc5eac1219
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Implement progressive
@override
functionality (#2911)The progressive
@override
feature brings a new argument to the@override
directive:label: String
. When a label is added to an@override
application, the override becomes conditional, depending on parameters provided to the query planner (a set of which labels should be overridden). Note that this feature will be supported in router for enterprise users only.Out-of-the-box, the router will support a percentage-based use case for progressive
@override
. For example:type Query { hello: String @override(from: "original", label: "percent(5)") }
The above example will override the root
hello
field from the "original" subgraph 5% of the time.More complex use cases will be supported by the router via the use of coprocessors/rhai to resolve arbitrary labels to true/false values (i.e. via a feature flag service).
- Updated dependencies [
6ae42942b13dccd246ccc994faa2cb36cd62cb3c
,66833fb8d04c9376f6ed476fed6b1ca237f477b7
,931f87c6766c7439936df706727cbdc0cd6bcfd8
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
038cf0dbbfb0e2978b69f0a14bfd2c38b0cd1326
,69495b4810f3268c45a31f9d12e4f9cde2c447b5
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
7b5b836d15247c997712a47847f603aa5887312e
,74ca7dd617927a20d79b824851f7651ef3c40a4e
,ffe67dfbdb77d15dde2ab6dee66dba05c7b5c037
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
0d5ab01a
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Add more information to OpenTelemetry spans. (#2700)
Rename
operationName
tographql.operation.name
and add agraphql.operation.type
attribute, in conformance with the OpenTelemetry Semantic Conventions for GraphQL. TheoperationName
attribute is now deprecated, but it is still emitted alongsidegraphql.operation.name
.Add a
graphql.document
span attribute to thegateway.request
span, containing the entire GraphQL source sent in the request. This feature is disable by default.When one or more GraphQL or internal errors occur, report them in the OpenTelemetry span in which they took place, as an exception event. This feature is disabled by default.
To enable the
graphql.document
span attribute and the exception event reporting, add the following entries to yourApolloGateway
instance configuration:const gateway = new ApolloGateway({ // ... telemetry: { // Set to `true` to include the `graphql.document` attribute includeDocument: true, // Set to `true` to report all exception events, or set to a number // to report at most that number of exception events per span reportExceptions: true, // or: reportExceptions: 1 }, });
-
Update
license
field inpackage.json
to useElastic-2.0
SPDX identifier (#2741) -
Introduce the new
@policy
scope for composition (#2818)Note that this directive will only be fully supported by the Apollo Router as a GraphOS Enterprise feature at runtime. Also note that composition of valid
@policy
directive applications will succeed, but the resulting supergraph will not be executable by the Gateway or an Apollo Router which doesn't have the GraphOS Enterprise entitlement.Users may now compose
@policy
applications from their subgraphs into a supergraph.The directive is defined as follows:
scalar federation__Policy directive @policy( policies: [[federation__Policy!]!]! ) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
The
Policy
scalar is effectively aString
, similar to theFieldSet
type.In order to compose your
@policy
usages, you must update your subgraph's federation spec version to v2.6 and add the@policy
import to your existing imports like so:@link(url: "https://specs.apollo.dev/federation/v2.6", import: [..., "@policy"])
-
Add graphql.operation.name attribute on gateway.plan span (#2807)
- Updated dependencies [
b18841be
,e325b499
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
a0bdd7cb
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
c719214a
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Fix specific case for requesting __typename on interface entity type (#2775)
In certain cases, when resolving a __typename on an interface entity (due to it actual being requested in the operation), that fetch group could previously be trimmed / treated as useless. At a glance, it appears to be a redundant step, i.e.:
{ ... on Product { __typename id }} => { ... on Product { __typename} }
It's actually necessary to preserve this in the case that we're coming from an interface object to an (entity) interface so that we can resolve the concrete __typename correctly.
-
Don't preserve useless fetches which downgrade __typename from a concrete type back to its interface type. (#2778)
In certain cases, the query planner was preserving some fetches which were "useless" that would rewrite **typename from its already-resolved concrete type back to its interface type. This could result in (at least) requested fields being "filtered" from the final result due to the interface's **typename in the data where the concrete type's __typename was expected.
Specifically, the solution was compute the path between newly created groups and their parents when we know that it's trivial (
[]
). Further along in the planning process, this allows to actually remove the known-useless group. -
Propagate type information when renaming entity fields (#2776)
Aliased entity fields might have been incorrectly overwritten if multiple fields/aliases shared the same name. Query planner automatically renames conflicting fields to ensure we can always generate a valid GraphQL query. The underlying issue was that this key rewriting logic was assuming the same type of an object. In case of entity queries asking for those aliased fields, we ended up always attempting to apply field renaming logic regardless, whether or not a given entity was of the correct type. This fix ensures that the query planner logic correctly accounts for the object type when applying field renaming logic.
-
Updated dependencies [
66d7e4ce
,a37bbbf6
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Adds header to change the format of exposed query plans, and allows formatting it as json. (#2724)
When the gateway is configured to allow it, adding the
Apollo-Query-Plan-Experimental
header to a request already allowed a "prettified" text version of the query plan used for the query is returned in the response extension. This changes adds support for a new (optional) accompanying header,Apollo-Query-Plan-Experimental-Format
, which can be set to the value "internal" to have the query plan returned as a json object (that correspond to the internal representation of that query plan) instead of the text version otherwise sent. Note that if that new header is not provided, then the query plan continues to be send in the previous prettified text version. -
Fix some potentially incorrect query plans with
@requires
when some dependencies are involved. (#2726)In some rare case of
@requires
, an over-eager optimisation was incorrectly considering that a dependency between 2 subgraph fetches was unnecessary, leading to doing 2 subgraphs queries in parallel when those should be done sequentially (because the 2nd query rely on results from the 1st one). This effectively resulted in the required fields not being provided (the consequence of which depends a bit on the resolver detail, but if the resolver expected the required fields to be populated (as they should), then this could typically result in a message of the formGraphQLError: Cannot read properties of null
). -
Updated dependencies [
203b0a44
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Fix execution error in some cases where aliases are used and some values are
null
. (#2716)The error would manifest itself as an
INTERNAL_SERVER_ERROR
with a message of the formCannot read properties of null
. -
Updated dependencies [
4b9a512b
,c6e0e76d
,1add932c
,6f1fddb2
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Remove extraneous call to
span.setStatus()
on a span which has already ended. (#2697)In cases where a subgraph responded with an error, we would sometimes try to set the status of a span which had already ended. This resulted in a warning log to the console (but no effect otherwise). This warning should no longer happen.
-
Fix
fallbackPollIntervalInMs
behavior. (#2709)The
fallbackPollIntervalInMs
serves 2 purposes:- it allows users to provide an Uplink poll interval if Uplink doesn't provide one
- it allows users to use a longer poll interval that what's prescribed by Uplink
The second bullet is how the configuration option is documented, but not how it was previously implemented. This change corrects the behavior to respect this configuration if it's provided AND is longer than the Uplink interval.
-
Updated dependencies [
35179f08
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Reapply #2639: (#2687)
Try reusing named fragments in subgraph fetches even if those fragment only apply partially to the subgraph. Before this change, only named fragments that were applying entirely to a subgraph were tried, leading to less reuse that expected. Concretely, this change can sometimes allow the generation of smaller subgraph fetches.
Additionally, resolve a bug which surfaced in the fragment optimization logic which could result in invalid/incorrect optimizations / fragment reuse.
-
Updated dependencies [
b9052fdd
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Do not run the full suite of graphQL validations on supergraphs and their extracted subgraphs by default in production environment. (#2657)
Running those validations on every updates of the schema takes a non-negligible amount of time (especially on large schema) and mainly only serves in catching bugs early in the supergraph handling code, and in some limited cases, provide slightly better messages when a corrupted supergraph is received, neither of which is worth the cost in production environment.
A new
validateSupergraph
option is also introduced in the gateway configuration to force this behaviour. -
Support responses from subgraphs which use the
application/graphql-response+json
content-type header. (#2162)See graphql-over-http spec for more details: https://graphql.github.io/graphql-over-http/draft/#sec-application-graphql-response-json
-
Introduce the new
@authenticated
directive for composition (#2644)Note that this directive will only be fully supported by the Apollo Router as a GraphOS Enterprise feature at runtime. Also note that composition of valid
@authenticated
directive applications will succeed, but the resulting supergraph will not be executable by the Gateway or an Apollo Router which doesn't have the GraphOS Enterprise entitlement.Users may now compose
@authenticated
applications from their subgraphs into a supergraph. This addition will support a future version of Apollo Router that enables authenticated access to specific types and fields via directive applications.The directive is defined as follows:
directive @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
In order to compose your
@authenticated
usages, you must update your subgraph's federation spec version to v2.5 and add the@authenticated
import to your existing imports like so:@link(url: "https://specs.apollo.dev/federation/v2.5", import: [..., "@authenticated"])
-
Introduce the new
@requiresScopes
directive for composition (#2649)Note that this directive will only be fully supported by the Apollo Router as a GraphOS Enterprise feature at runtime. Also note that composition of valid
@requiresScopes
directive applications will succeed, but the resulting supergraph will not be executable by the Gateway or an Apollo Router which doesn't have the GraphOS Enterprise entitlement.Users may now compose
@requiresScopes
applications from their subgraphs into a supergraph. This addition will support a future version of Apollo Router that enables scoped access to specific types and fields via directive applications.The directive is defined as follows:
scalar federation__Scope directive @requiresScopes( scopes: [federation__Scope!]! ) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
The
Scope
scalar is effectively aString
, similar to theFieldSet
type.In order to compose your
@requiresScopes
usages, you must update your subgraph's federation spec version to v2.5 and add the@requiresScopes
import to your existing imports like so:@link(url: "https://specs.apollo.dev/federation/v2.5", import: [..., "@requiresScopes"])
- Updated dependencies [
fe1e3d7b
,aac2893a
,6b18af50
,9396c0d6
,2b5796a9
,4f3c3b9e
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Revert #2639 from v2.4.9 (#2681)
PR #2639 attempts to resolve issues with query fragment reuse, but we've since turned up multiple issues (at least 1 of which is a regression - see #2680. For now, this reverts it until we resolve the regression for a future patch release.
-
Updated dependencies [
b6be9f96
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Try reusing named fragments in subgraph fetches even if those fragment only apply partially to the subgraph. Before this change, only named fragments that were applying entirely to a subgraph were tried, leading to less reuse that expected. Concretely, this change can sometimes allow the generation of smaller subgraph fetches. (#2639)
-
Updated dependencies [
7ac83456
,d60349b3
,1bb7c512
,02eab3ac
,fd4545c2
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
62e0d254
,1293034c
,7f1ef73e
,2a97f372
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Re-work the code use to try to reuse query named fragments to improve performance (thus sometimes improving query (#2604)
planning performance), to fix a possibly raised assertion error (with a message of form like
Cannot add selection of field X to selection set of parent type Y
), and to fix a rare issue where an interface or union field was not being queried for all the types it should be. - Updated dependencies [
2d44f346
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
5cd17e69
,8ca107ac
,e136ad87
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Supersedes v2.4.4 due to a publishing error with no dist/ folder (#2583)
-
Updated dependencies [
c96e24c4
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Fix incorrect import the
assert
function in theDataRewrite.ts
. The incorrect method was imported (due to a bad (#2581) import auto-completion) and went unnoticed, leading to potential build issue. - Updated dependencies [
cb7f414d
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
f6a8c1ce
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Fix potential bug when an
@interfaceObject
type has a@requires
. When an@interfaceObject
type has a field with a (#2524)@requires
and the query requests that field only for some specific implementations of the corresponding interface, then the generated query plan was sometimes invalid and could result in an invalid query to a subgraph (against a subgraph that rely on@apollo/subgraph
, this lead the subgraph to produce an error message looking like"The _entities resolver tried to load an entity for type X, but no object or interface type of that name was found in the schema"
). - Updated dependencies [
2c370508
,179b4602
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Fix issues (incorrectly rejected composition and/or subgraph errors) with
@interfaceObject
. Those issues may occur (#2494) either due to some use of@requires
in an@interfaceObject
type, or when some subgraphS
defines a type that is an implementation of an interfaceI
in the supergraph, and there is an@interfaceObject
forI
in another subgraph, butS
does not itself definesI
. -
Fix handling of aliases and variables in introspection queries. (#2506)
-
Start building packages with TS 5.x, which should have no effect on consumers (#2480)
-
Improves reuse of named fragments in subgraph fetches. When a question has named fragments, the code tries to reuse (#2497) those fragment in subgraph fetches is those can apply (so when the fragment is fully queried in a single subgraph fetch). However, the existing was only able to reuse those fragment in a small subset of cases. This change makes it much more likely that if a fragment can be reused, it will be.
-
Updated dependencies [
450b9578
,afde3158
,eafebc3c
,01fe3f83
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
This change introduces a configurable query plan cache. This option allows (#2385) developers to provide their own query plan cache like so:
new ApolloGateway({ queryPlannerConfig: { cache: new MyCustomQueryPlanCache(), }, });
The current default implementation is effectively as follows:
import { InMemoryLRUCache } from "@apollo/utils.keyvaluecache"; const cache = new InMemoryLRUCache<string>({ maxSize: Math.pow(2, 20) * 30, sizeCalculation<T>(obj: T): number { return Buffer.byteLength(JSON.stringify(obj), "utf8"); }, });
TypeScript users should implement the
QueryPlanCache
type which is now exported by@apollo/query-planner
:import { QueryPlanCache } from '@apollo/query-planner'; class MyCustomQueryPlanCache implements QueryPlanCache { // ... }
-
Adds debug/testing query planner options (
debug.bypassPlannerForSingleSubgraph
) to bypass the query planning (#2441) process for federated supergraph having only a single subgraph. The option is disabled by default, is not recommended for production, and is not supported (it may be removed later). It is meant for debugging/testing purposes.
-
Refactor the internal implementation of selection sets used by the query planner to decrease the code complexity and (#2387) improve query plan generation performance in many cases.
-
Optimises query plan generation for parts of queries that can statically be known to not cross across subgraphs (#2449)
-
Updated dependencies [
260c357c
,7bc0f8e8
,d4426ff9
,a9385bdb
,1a555d98
,ade7ceb8
,09382e74
,cab383b2
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
7bc0f8e8
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
This change introduces a configurable query plan cache. This option allows (#2385) developers to provide their own query plan cache like so:
new ApolloGateway({ queryPlannerConfig: { cache: new MyCustomQueryPlanCache(), }, });
The current default implementation is effectively as follows:
import { InMemoryLRUCache } from "@apollo/utils.keyvaluecache"; const cache = new InMemoryLRUCache<string>({ maxSize: Math.pow(2, 20) * 30, sizeCalculation<T>(obj: T): number { return Buffer.byteLength(JSON.stringify(obj), "utf8"); }, });
TypeScript users should implement the
QueryPlanCache
type which is now exported by@apollo/query-planner
:import { QueryPlanCache } from '@apollo/query-planner'; class MyCustomQueryPlanCache implements QueryPlanCache { // ... }
-
Adds debug/testing query planner options (
debug.bypassPlannerForSingleSubgraph
) to bypass the query planning (#2441) process for federated supergraph having only a single subgraph. The option is disabled by default, is not recommended for production, and is not supported (it may be removed later). It is meant for debugging/testing purposes.
- Updated dependencies [
d4426ff9
,a9385bdb
,6e2d24b5
,1a555d98
,ade7ceb8
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
- Updated dependencies [
09382e74
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Handle defaulted variables correctly during post-processing. (#2443)
Users who tried to use built-in conditional directives (skip/include) with defaulted variables and no variable provided would encounter an error thrown by operation post-processing saying that the variables weren't provided. The defaulted values went unaccounted for, so the operation would validate but then fail an assertion while resolving the conditional.
With this change, defaulted variable values are now collected and provided to post-processing (with defaults being overwritten by variables that are actually provided).
-
Updated dependencies [
6e2d24b5
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Update @apollo/utils.logger typings dependency (#2269)
-
Exposes, for each subgraph request, the path in the overall gateway operation at which that subgraph request gets inserted. This path is now available as the pathInIncomingRequest field in the arguments of RemoteGraphQLDataSource.willSendRequest and RemoteGraphQLDataSource.didReceiveResponse. (#2384)
-
Previously the
queryPlanStoreKey
was a hash of the query concatenated with an unhashedoperationName
if it was present. This resulted in variable length cache keys that could become unnecessarily long, occupying additional space in the query plan cache. (#2310)This change incorporates the
operationName
into the hash itself (ifoperationName
is present). -
Update @apollo/utils.createhash package, which drops support for node 12 (#2266)
-
Update @apollo/utils.isnodelike package, which dropped support for node 12 (#2268)
-
Update @apollo/utils.fetcher package, which drops support for node 12 (#2267)
-
Updated dependencies [
71a07f30
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Move gateway post-processing errors from
errors
intoextensions.valueCompletion
of the response (#2380)[https://github.com/apollographql/federation/pull/2335](PR #2335) introduced a breaking change that broke existing usages with respect to nullability and gateway error handling. In response to [https://github.com/apollographql/federation/issues/2374](Issue #2374), we are reverting the breaking portion of this change by continuing to swallow post processing errors as the gateway did prior to v2.3.0. Instead, those errors will now be included on the
extensions.valueCompletion
object in the response object.Gateway v2.3.0 and v2.3.1 are both affected by this change in behavior.
-
Updated dependencies []:
- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
-
Capture non-ftv1 error information in metrics data. This (#2242) error information allows the inline trace plugin to correctly aggregate stats about errors (where no federated trace data is available) and stop reporting incomplete traces which are missing unavailable error information.
This PR is a precursor to apollographql/apollo-server#7136
-
Fix issue where the query planner was incorrectly not querying
__typename
in a subgraph fetch when@interfaceObject
is involved (#2366) -
Updated dependencies [
7e2ca46f
,eb5a8bc0
]:- @apollo/[email protected]
- @apollo/[email protected]
- @apollo/[email protected]
This CHANGELOG pertains only to Apollo Federation packages in the 2.x range. The Federation v0.x equivalent for this package can be found here on the version-0.x
branch of this repo.
- Fix unexpected composition error about
@shareable
field when@external
is on a type in a fed1 schema (one without@link
) PR #2343. - Fix issue with some
@interfaceObject
queries due to missing "input rewrites" PR #2346.
- Rewrites gateway response post-processing to avoid
@interfaceObject
related issues PR 2335. - Generates correct response error paths for errors thrown during entity fetches PR #2304.
- Improves generation of plans once all path options are computed PR #2316.
- Fixes composition issues with
@interfaceObject
PR #2318. - Fix potential issue with nested
@defer
in non-deferrable case PR #2312. - Adds support for the 0.3 version of the tag spec, which adds
@tag
directive support for theSCHEMA
location PR #2314. - Error on composition when a
@shareable
field runtime types don't intersect between subgraphs: a@shareable
field must resolve the same way in all the subgraphs, but this is impossible if the concrete runtime types have no intersection at all PR #1556.
- BREAKING: composition now rejects
@override
on interface fields. The@override
directive was not meant to be supported on interfaces and was not having any impact whatsoever. If an existing subgraph does have a@override
on an interface field, this will now be rejected, but the@override
can simply and safely be removed since it previously was ignored. - Adds support for
@interfaceObject
and keys on interfaces PR #2279. - Preserves source of union members and enum values in supergraph PR #2288.
- Fix possible assertion error during query planning PR #2299
- Fix potential issue with nested @defer in non-deferrable case PR #2312
- Fix issue with path in query plan's deferred nodes PR #2281.
- Fix federation spec always being expanded to the last version PR #2274.
- BREAKING: Disable exposing full document to sub-query by default (introduced 2.1.0):
- This change decreases memory consumption in general (which is the reason for disabling this by
default), but users that have custom code making use of
GraphQLDataSourceProcessOptions.document
will now need to explicitly setGatewayConfig.queryPlannerConfig.exposeDocumentNodeInFetchNode
.
- This change decreases memory consumption in general (which is the reason for disabling this by
default), but users that have custom code making use of
- BREAKING: composition now rejects
@shareable
on interface fields. The@shareable
directive is about controlling if multiple subgraphs can resolve a particular field, and as interface field are never directly resolved (it's their implementation that are), having@shareable
on interface fields is not completely meaningful and was never meant to be supported. If an existing subgraph does have a@shareable
on an interface field, this will now be rejected, but the@shareable
can simply and safely be removed since it previously was ignored. - Allows
@shareable
to be repeatable so it can be allowed on both a type definition and its extensions PR #2175.- Note that this require the use of the new 2.2 version of the federation spec introduced in this change.
- Preserve default values of input object fields PR #2218.
- Drop support for node12 PR #2202
- Fix issue where QP was generating invalid plan missing some data #361.
- Avoid reusing named fragments that are invalid for the subgraph PR #2255.
- Fix QP not always type-exploding interface when necessary PR #2246.
- Fix potential QP issue with shareable root fields PR #2239.
- Correctly reject field names starting with
__
PR #2237. - Fix error when a skipped enum value had directives applied PR #2232.
- Preserve default values of input object fields PR #2218.
- Ensures supergraph
@defer
/@stream
definitions of supergraph are not included in the API schema PR #2212. - Optimize plan for defer where only keys are fetched PR #2182.
- Improves error message to help with misspelled source of an
@override
PR #2181. - Fix validation of variable on input field not taking default into account PR #2176.
- Fix building subgraph selections using the wrong underlying schema PR #2155.
- Allow fields with arguments in
@requires
PR #2120. - Fix potential inefficient planning due to
__typename
PR #2137. - Fix potential assertion during query planning PR #2133.
- Fix some defer query plans having invalid result sets (with empty branches) PR #2125.
- Fix defer information lost when cloning fetch group (resulting in non-deferred parts) PR #2129.
- Fix directives on fragment spread being lost PR #2126.
- Fix build-time regression caused by #1970 (removal of @types/node-fetch from runtime dependencies) PR #2116
- The method
RemoteGraphQLDataSource.errorFromResponse
now returns aGraphQLError
(as defined bygraphql
) rather than anApolloError
(as defined byapollo-server-errors
). PR #2028- BREAKING: If you call
RemoteGraphQLDataSource.errorFromResponse
manually and expect its return value to be a particular subclass ofGraphQLError
, or if you expect the error received bydidEncounterError
to be a particular subclass ofGraphQLError
, then this change may affect you. We recommend checkingerror.extensions.code
instead.
- BREAKING: If you call
- The
LocalGraphQLDataSource
class no longer supports the undocumented__resolveObject
Apollo Server feature. PR #2007- BREAKING: If you relied on the undocumented
__resolveObject
feature withLocalGraphQLDataSource
, it will no longer work. If this affects you, file an issue and we can help you find a workaround.
- BREAKING: If you relied on the undocumented
- Fix issue when using a type condition on an inaccessible type in
@require
#1873.- BREAKING: this fix required passing a new argument to the
executeQueryPlan
method, which is technically exported by the gateway. Most users of the gateway should not call this method directly (which is exported mainly for testing purposes in the first place) and will thus be unaffected, but if you do call this method directly, you will have to pass the new argument when upgrading. See the method documentation for details.
- BREAKING: this fix required passing a new argument to the
- Reject directive applications within
fields
of@key
,@provides
and@requires
PR #1975.- BREAKING: previously, directive applications within a
@key
,@provides
or@requires
were parsed but not honored in any way. As this change reject such applications (at composition time), it could theoretically require to remove some existing (ignored) directive applications within a@key
,@provides
or@requires
.
- BREAKING: previously, directive applications within a
- Fix issue where fragment expansion can erase applied directives (most notably
@defer
) PR #2093. - Fix abnormally high memory usage when extracting subgraphs for some fed1 supergraphs (and small other memory footprint improvements) PR #2089.
- Fix issue with fragment reusing code something mistakenly re-expanding fragments PR #2098.
- Fix issue when type is only reachable through a @provides PR #2083.
- Fix case where some key field necessary to a
@require
fetch were not previously fetched PR #2075. - Add type definitions to schema extensions PR #2081
- Update peer dependency
graphql
to^16.5.0
to useGraphQLErrorOptions
PR #2060 - Upgrade underlying
@apollo/utils.fetcher
to support aborting a request. This is a type-only change, and will not impact the underlying runtime. PR #2017. - Some TypeScript types, such as the arguments and return value of
GraphQLDataSource.process
, are defined using types from the@apollo/server-gateway-interface
package instead of fromapollo-server-types
andapollo-server-core
. This is intended to be fully backwards-compatible; please file an issue if this leads to TypeScript compilation issues. PR #2044 - Don't require
@link
when using@composeDirective
PR #2046 - Don't do debug logging by default PR #2048
- Add
@composeDirective
directive to specify directives that should be merged to the supergraph during composition PR #1996. - Fix fragment reuse in subgraph fetches PR #1911.
- Custom
fetcher
s should now accept aRequest
object which has asignal: AbortSignal
property https://fetch.spec.whatwg.org/#requestinit for request timeout purposes. PR #2017 - Expose document representation of sub-query request within GraphQLDataSourceProcessOptions so that it is available to RemoteGraphQLDataSource.process and RemoteGraphQLDataSource.willSendRequest PR#1878
- Cleanup error related code, adding missing error code to a few errors PR #1914.
- Fix issue generating plan for a "diamond-shaped" dependency PR #1900.
- Fix issue computing query plan costs that can lead to extra unnecessary fetches PR #1937.
- Move
DEFAULT_UPLINK_ENDPOINTS
to static member ofUplinkSupergraphManager
PR #1977. - Add
node-fetch
as a runtime dependency PR #1970. - Add timeouts when making requests to Apollo Uplink PR #1950.
- Avoid type-explosion with fed1 supergraphs using a fed2 query planner PR #1994.
- Add callback when fetching a supergraph from Apollo Uplink fails PR #1812.
- Expand support for Node.js v18 PR #1884
- Fix bug with unsatisfiable query branch when handling federation 1 supergraph PR #1908.
- Fix issue when all root operations were defined in an
extend schema
PR #1875.
- Fix bug with type extension of empty type definition PR #1821
- Fix output of
printSubgraphSchema
method, ensuring it can be read back by composition andbuildSubgraphSchema
PR #1831. - Fix issue with
@requires
and conditional queries (@include
/@skip
) 1835. - Fix bug with field covariance when the underlying plan use type-explosion 1859.
- BREAKING: We no longer export a
getDefaultFetcher
function. This function returned the defaultfetch
implementation used to talk to Uplink (which is distinct from the defaultfetch
implementation used byRemoteGraphQLDataSource
to talk to subgraphs). It was the fetcher frommake-fetch-happen
v8 with some preset configuration relating to caching and request headers. However, the caching configuration was not actually being used when talking to Uplink (as we talk to Uplink over POST requests, and the Uplink protocol has an application-level mechanism for avoiding unnecessary large responses), and the request headers were already being provided explicitly by the Uplink client code. Since this release is also upgradingmake-fetch-happen
, it is impossible to promise that there would be no behavior change at all to the fetcher returned frommake-fetch-happen
, and as none of the preset configuration is actually relevant to the internal use ofgetDefaultFetcher
(which now just usesmake-fetch-happens
without extra configuration), we have removed the function. If you were using this function, you can replaceconst fetcher = getDefaultFetcher()
withimport fetcher from 'make-fetch-happen'
. PR #1805 - The
fetch
implementation used by default byUplinkFetcher
andRemoteGraphQLDataSource
is now imported frommake-fetch-happen
v10 instead of v8. The fetcher used byRemoteGraphQLDataSource
no longer limits the number of simultaneous requests per subgraph (or specifically, per host/port pair) to 15 by default; instead, there is no limit. (If you want to restore the previous behavior, installmake-fetch-happen
, importfetcher
from it, and passnew RemoteGraphQLDataSource({ fetcher: fetcher.defaults(maxSockets: 15)}))
in yourbuildService
option.) Note that if you invoke thefetcher
yourself in aRemoteGraphQLDataSource
subclass, you should ensure that you pass "plain" objects rather thanHeaders
orRequest
objects, as the newer version has slightly different logic about how to recognizeHeaders
andRequest
objects. We have adjusted the TypeScript types forfetcher
so that only these "plain" objects (which result in consistent behavior across all fetcher implementations) are permitted. PR #1805 - Fix
Schema.clone
when directive application happens before definition PR #1785 - More helpful error message for errors encountered while reading supergraphs generated pre-federation 2 PR #1796
- Fix handling of @require "chains" (a @require whose fields have @require themselves) PR #1790
- Fix bug applying an imported federation directive on another directive definition PR #1797.
- Fix bug where planning a query with
@require
impacts the plans of followup queries PR #1783. - Improve fed1 schema support during composition PR #1735
- Add missing @apollo/federation-internals dependency to gateway PR #1721
- Improve merging of groups during
@require
handling in query planning PR #1732 - Move
__resolveReference
resolvers on toextensions
PR #1746 - Add gateway version to schema extensions PR #1751
- Honor directive imports when directive name is spec name PR #1720
- Migrate to
@apollo/utils
packages forcreateSHA
andisNodeLike
PR #1765
- Use
for: SECURITY
in the core/link directive application in the supergraph for@inaccessible
PR #1715
- Previous preview release promoted to general availability. Please see previous changelog entries for full info.
- Implement
buildSubgraphSchema
using federation internals PR #1697
- Revert previous
@apollo/core-schema
update due to incompatibilities with some existing schemas PR #1704
- Generate a core schema in
buildSubgraphSchema
, incorporating the latest changes from@apollo/core-schema
PR #1554
- Fix issues validating default values PR #1692).
- Add a level to hints, uppercase their code and related fixes PR #1683.
- Add support for
@inaccessible
v0.2 PR #1678
- Fix merging of Input objects and enum types PR #1672.
- Relax validation of directive redefinition for scalar PR #1674.
- Fix regression in composition validation introduced by #1653 PR #1673 .
- Update logging PR #1688 and test PR #1685 dependencies.
- Adds support for the
@override
directive on fields to indicate that a field should be moved from one subgraph to another. PR #1484 - Fix handling of core/link when definitions are provided or partially so PR #1662.
- Optimize composition validation when many entities spans many subgraphs PR #1653.
- Support for Node 17 PR #1541.
- Adds support for
@tag/v0.2
, which allows the@tag
directive to be additionally placed on arguments, scalars, enums, enum values, input objects, and input object fields. PR #1652. - Fix introspection query by adding missing
includeDeprecated
argument forargs
andinputFields
when defining introspection fields PR #1584 - Throw a
GraphQLSchemaValidationError
for issues with the@inaccessible
directive when callingtoApiSchema
. The error will contain a list of all validation errors pertaining to@inaccessible
PR #1563.
NOTE: Be sure to update to this version of gateway before upgrading composition. See below and the changelog for @apollo/composition
.
- Adds support for
@inaccessible
in subgraphs PR #1638. - Fix merging of
@tag
directive when it is renamed in subgraphs PR #1637. - Handles supergraphs with
@link
instead of@core
. Note that you should upgrade gateway to this version before upgrading composition PR #1628.
- Automatically add the
@tag
directive definition inbuildSubgraphSchema
(but still support it if the definition is present in the input document) PR #1600.
- Fix propagation of
@tag
to the supergraph and allows @tag to be repeated. Additionally, merged directives (only@tag
and@deprecated
currently) are not allowed on external fields anymore PR #1592.
- Make error messages more actionable when constructing subgraphs from a supergraph PR #1586
- Respect the
minDelaySeconds
returning from Uplink when polling and retrying to fetch the supergraph schema from Uplink PR #1564 - Remove the previously deprecated
experimental_pollInterval
config option and deprecatepollIntervalInMs
in favour offallbackPollIntervalInMs
(for managed mode only). PR #1564 - Correctly detect promises wrapped by proxies in entities resolver PR #1584
- Fix issue that created type extensions with descriptions, which is invalid graphQL syntax PR #1582.
- Re-publishing release which published to npm with stale build artifacts from
version-0.x
release.
- No-op publish to account for publishing difficulties.
- Fix merging of arguments by composition PR #1567.
- Adds an optional
resolvable
argument to the@key
directive PR #1561. - Generates operation names in query plans when the original query is named PR #1550;
- Allow
@key
to be used on fields with a list type PR #1510 - Identifies federation 2 schema using new
@link
directive to link to the federation 2 spec. Schema not linking to federation 2 are interpreted as federation 0.x schema and automatically converted before composition PR #1510. - Adds
@shareable
directive to control when fields are allowed to be resolved by multiple subgraphs PR #1510.
- Use specific error classes when throwing errors due Apollo Uplink being unreacheable or returning an invalid response PR #1473
- FIX Correct retry logic while fetching the supergraph schema from Uplink PR #1503
- Avoid incomplete subgraphs when extracting them from the supergraph. PR #1511 (via fix to
@apollo/query-planner
and@apollo/federation-internals
)
- Reject mismatching types for interface field implementation if some of those implementations are
@external
, since this can lead to invalid subgraph queries at runtime PR #1318. This limitation should be lifted in the future once the root cause (the invalid runtime queries) is fixed by issue #1257. - Fix potentially inefficient query plans with multiple
@requires
PR #1431. - Remove
graphql@15
from peer dependencies PR #1472.
- BREAKING: This change improves the
supergraphSdl
configuration option to provide a clean and flexible interface for updating gateway schema on load and at runtime. This PR brings a number of updates and deprecations to the gateway. Previous options for loading the gateway's supergraph (serviceList
,localServiceList
,experimental_updateServiceDefinitions
,experimental_supergraphSdl
) are all deprecated going forward. The migration paths all point to the updatedsupergraphSdl
configuration option.
The most notable change here is the introduction of the concept of a SupergraphManager
(one new possible type of supergraphSdl
). This interface (when implemented) provides a means for userland code to update the gateway supergraph dynamically, perform subgraph healthchecks, and access subgraph datasources. All of the mentioned deprecated configurations now either use an implementation of a SupergraphManager
internally or export one to be configured by the user (IntrospectAndCompose
and LocalCompose
).
For now: all of the mentioned deprecated configurations will still continue to work as expected. Their usage will come with deprecation warnings advising a switch to supergraphSdl
.
serviceList
users should switch to the now-exportedIntrospectAndCompose
class.localServiceList
users should switch to the similarLocalCompose
class.experimental_{updateServiceDefinitions|supergraphSdl}
users should migrate their implementation to a customSupergraphSdlHook
orSupergraphManager
.
Since the gateway itself is no longer responsible for composition:
experimental_didUpdateComposition
has been renamed more appropriately toexperimental_didUpdateSupergraph
(no signature change)experimental_compositionDidFail
hook is removed
experimental_pollInterval
is deprecated and will issue a warning. Its renamed equivalent is pollIntervalInMs
.
Some defensive code around gateway shutdown has been removed which was only relevant to users who are running the gateway within ApolloServer
before v2.18. If you are still running one of these versions, server shutdown may not happen as smoothly.
- Upgrading graphql dependency to
16.2.0
PR #1129.
- RemoteGraphQLDataSource will now use
make-fetch-happen
by default rather thannode-fetch
PR #1284 - NOOP: Fix OOB testing w.r.t. nock hygiene. Pushed error reporting endpoint responsibilities up into the gateway class, but there should be no effect on the runtime at all. PR #1309
- Multi-cloud Uplink capability PR #1283: now, by default two separate Uplink services will be used for schema fetching, the system will round-robin and if one service fails, a retry will occur and the other service will be called.
- The Uplink URLs are
https://uplink.api.apollographql.com/
(GCP) andhttps://aws.uplink.api.apollographql.com/
(AWS). - To override these defaults and configure what Uplink services, there are two options:
- Option #1: use the existing environment variable
APOLLO_SCHEMA_CONFIG_DELIVERY_ENDPOINT
which will now be treated as a comma-separated list of URLs. - Option #2: use the new
uplinkEndpoints
, which must be single URL or a comma-separated list of URLs for the Uplink End-points to be used, anduplinkMaxRetries
which is how many times the Uplink URLs should be retried.
- Option #1: use the existing environment variable
- The old
schemaConfigDeliveryEndpoint
configuration value still work, but is deprecated and will be removed in a subsequent release.
- The Uplink URLs are
- Continue resolving when an
@external
reference cannot be resolved #376. - Fix issue reading some 0.x generated supergraphs PR #1351.
- Assign and document error codes for all errors PR #1274.
- Fix bug in handling of large number of query plan options 1316.
- Remove unused dependency on
@apollographql/apollo-tools
1304.
- BREAKING: Bump graphql peer dependency to
^15.7.0
PR #1200 - BREAKING: Remove legacy GCS fetcher for schema updates. If you're currently opted-in to the backwards compatibility provided by setting
schemaConfigDeliveryEndpoint: null
, you may be affected by this update. Please see the PR for additional details. PR #1226 - Conditional schema update based on ifAfterId PR #1152
- Fix the handling of nested
@provides
directives PR #1148. - Remove outdated composition code. A concrete consequence of which is the removal of the
@apollo/federation
package. If your code was importing theServiceDefinition
interface from@apollo/federation
, this can now be imported from@apollo/gateway
PR #1208. - Fix query planner sending queries to a subgraph involving interfaces it doesn't know #817.
- 🎉 Initial alpha release of Federation 2.0. For more information, see our documentation. We look forward to your feedback!
Changelog entries for gateway 0.x are published on the version-0.x branch.