25 KiB
CHANGELOG for @apollo/gateway
vNEXT
The changes noted within this
vNEXTsection have not been released yet. New PRs and commits which introduce changes should include an entry in thisvNEXTsection as part of their development. When a release is being prepared, a new header will be (manually) created below and the appropriate changes within that release will be moved into the new section.
- Whenever "AccessDenied" 403 error comes from Apollo, provide a useful error message indicating how to resolve the problem. PR #245
v0.21.0
- Fix
Cannot convert undefined or null to objecterror which occurred when nullable variables were declared/used within an operation (i.e.query) document butvariableswas undefined on the request. PR #167 Issue #196 - When using a custom
fetcheron aRemoteGraphQLDataSource, use that fetcher'sRequestinitialization in order to satisfy and of its own implementation details. This is necessary, for example, when usingmake-fetch-happen. PR #188 Issue #191
v0.20.4
- Adjust a
preinstallscript which was only intended to be executed by the monorepo tool-chain, not merely by installing the@apollo/gatewaypackage as a dependency in another project. PR #185 Issue #184
v0.20.3
- Read managed federation configuration from the
apollooption toApolloGateway.loadrather than the deprecatedengineoption, when available (ie, when running Apollo Server v2.18+), and update error messages referring to the old Engine and Graph Manager product names. PR #148 - FIX: Directives which are located on inline fragments should not be skipped and should be sent to the service PR #178
v0.20.2
- FIX: Minifying a String argument should escape quotes and slashes PR #174
v0.20.1
- Replace the query planner implementation with a new implementation written in rust and integrated into the gateway via wasm. PR #4534
v0.20.0
- Only changes in the similarly versioned
@apollo/federationpackage.
v0.19.1
- Only changes in the similarly versioned
@apollo/federationpackage.
v0.19.0
- Only changes in the similarly versioned
@apollo/federationpackage.
v0.18.1
- FIX: Pass null required fields correctly within the parent object to resolvers. When a composite field was null, it would sometimes be expanded into an object with all null subfields and passed to the resolver. This fix prevents this expansion and sets the field to null, as originally intended. PR #4157
- FIX: Prevent gateway from entering an inoperable state after an initial configuration load failure. PR #4277
v0.18.0
- The
RemoteGraphQLDataSource'sdidEncounterErrormethod will now receiveResponseas the third argument when it is available, making its signature(error: Error, fetchRequest: Request, fetchResponse?: Response). This compliments the existingRequesttype it was already receiving. Both of these types are HTTP WHATWG Fetch API types, notGraphQLRequest,GraphQLResponsetypes.
v0.17.0
- BREAKING: Move federation metadata from custom objects on schema nodes over to the
extensionsfield on schema nodes which are intended for metadata. This is a breaking change because it narrows thegraphqlpeer dependency from^14.0.2to^14.5.0which is whenextensionswere introduced for all Type System objects. PR #4313
v0.16.11
- Only changes in the similarly versioned
@apollo/federationpackage.
v0.16.10
- The default branch of the repository has been changed to
main. As this changed a number of references in the repository'spackage.jsonandREADME.mdfiles (e.g., for badges, links, etc.), this necessitates a release to publish those changes to npm. PR #4302 - FIX: The cache implementation for the HTTP-fetcher which is used when communicating with the Apollo Registry when the gateway is configured to use managed federation will no longer write to its cache when it receives a 304 response. This is necessary since such a response indicates that the cache used to conditionally make the request must already be present. This does not affect GraphQL requests at runtime, only the polling and fetching mechanism for retrieving composed schemas under manged federation. PR #4325
- FIX: The
mergeFieldNodeSelectionSetsmethod no longer mutates original FieldNode objects. Before, it was updating the selection set of the original object, corrupting the data accross requests.
v0.16.9
- Only changes in the similarly versioned
@apollo/federationpackage.
v0.16.7
- Bumped the version of
apollo-server-core, but no other changes!
v0.16.6
- Only changes in the similarly versioned
@apollo/federationpackage.
v0.16.5
- Only changes in the similarly versioned
@apollo/federationpackage.
v0.16.4
- NEW: Provide the
requestContextas an argument to the experimental callback functionexperimental_didResolveQueryPlan. #4173
v0.16.3
- This updates a dependency of
apollo-server-corethat is only used for its TypeScript typings, not for any runtime dependencies. The reason for the upgrade is that theapollo-server-corepackage (again, used only for types!) was affected by a GitHub Security Advisory. See the relatedCHANGELOG.mdfor Apollo Server for more details, including a link to the advisory.
v0.16.2
- FIX: Collapse nested required fields into a single body in the query plan. Before, some nested fields' selection sets were getting split, causing some of their subfields to be dropped when executing the query. This fix collapses the split selection sets into one. #4064
v0.16.1
-
NEW: Provide the ability to pass a custom
fetcherduringRemoteGraphQLDataSourceconstruction to be used when executing operations against downstream services. Providing a customfetchermay be necessary to accommodate more advanced needs, e.g., configuring custom TLS certificates for internal services. PR #4149The
fetcherspecified should be a compliant implementor of the Fetch API standard. This addition compliments, though is still orthognonal to, similar behavior originally introduced in #3783, which allowed customization of the implementation used to fetch gateway configuration and federated SDL from services in managed and unmanaged modes, but didn't affect the communication that takes place during operation execution.For now, the default
fetcherwill remain the same (node-fetch) implementation. A future major-version bump will update it to be consistent with other feature-rich implementations of the Fetch API which are used elsewhere in the Apollo Server stack where we usemake-fetch-happen. In all likelihood,ApolloGatewaywill pass its ownfetcherto theRemoteGraphQLDataSourceduring service initialization.
v0.16.0
- BREAKING: Use a content delivery network for managed configuration, fetch storage secrets and composition configuration from different domains: https://storage-secrets.api.apollographql.com and https://federation.api.apollographql.com. Please mind any firewall for outgoing traffic. #4080
v0.15.1
- FIX: Correctly handle unions with nested conditions that have no
possibleTypes#4071 - FIX: Normalize root operation types when reporting to Apollo Graph Manager. Federation always uses the default names
Query,Mutation, andSubscriptionfor root operation types even if downstream services choose different names; now we properly normalize traces received from downstream services in the same way. #4100
v0.15.0
- BREAKING: Drop support for Node.js 8 and Node.js 10. This is being done primarily for performance gains which stand to be seen by transpiling to a newer ECMAScript target. For more details, see the related PR. #4031
- Performance: Cache stringified representations of downstream query bodies within the query plan to address performance cost incurred by repeatedly
printing the sameDocumentNodes with thegraphqlprinter. This improvement is more pronounced on larger documents. PR #4018 - Deprecation: Deprecated the
ENGINE_API_KEYenvironment variable in favor of its new name,APOLLO_KEY. The new name mirrors the name used within Apollo Graph Manager. Aside from the rename, the functionality remains otherwise identical. Continued use ofENGINE_API_KEYwill result in deprecation warnings being printed to the server console. Support forENGINE_API_KEYwill be removed in a future, major update. #3923 - Deprecation: Deprecated the
APOLLO_SCHEMA_TAGenvironment variable in favor of its new name,APOLLO_GRAPH_VARIANT. The new name mirrors the name used within Apollo Graph Manager. Aside from the rename, the functionality remains otherwise identical. Use of the now-deprecated name will result in a deprecation warning being printed to the server console. Support will be removed entirely in a future, major update. To avoid misconfiguration, runtime errors will be thrown if the new and deprecated versions are both set. #3855 - Add inadvertently excluded
apollo-server-errorsruntime dependency. #3927
v0.14.1
- FIX: Resolve condition which surfaced in
0.14.0which prevented loading the configuration using managed federation. PR #3979
v0.14.0
- Several previously unhandled Promise rejection errors stemming from, e.g. connectivity, failures when communicating with Apollo Graph Manager within asynchronous code are now handled. PR #3811
- Provide a more helpful error message when encountering expected errors. PR #3811
- General improvements and clarity to error messages and logging. PR #3811
- Warn of a possible misconfiguration when local service configuration is provided (via
serviceListorlocalServiceList) and a remote Apollo Graph Manager configuration is subsequently found as well. PR #3868 - During composition, the unavailability of a downstream service in unmanaged federation mode will no longer result in a partially composed schema which merely lacks the types provided by the downed service. This prevents unexpected validation errors for clients querying a graph which lacks types which were merely unavailable during the initial composition but were intended to be part of the graph. PR #3867
- Support providing a custom logger implementation (e.g.
winston,bunyan, etc.) to capture gateway-sourced console output. This allows the use of existing, production logging facilities or the possibiltiy to use advanced structure in logging, such as console output which is encapsulated in JSON. The same PR that introduces this support also introduces aloggerproperty to theGraphQLRequestContextthat is exposed toGraphQLDataSources and Apollo Server plugins, making it possible to attach additional properties (as supported by the logger implementation) to specific requests, if desired, by leveraging custom implementations in those components respectively. When not provided, these will still output toconsole. PR #3894 - Drop use of
loglevel-debug. This removes the very long date and time prefix in front of each log line and also the support for theDEBUG=apollo-gateway:environment variable. Both of these were uncommonly necessary or seldom used (with the environment variable also being undocumented). The existing behavior can be preserved by providing aloggerthat usesloglevel-debug, if desired, and more details can be found in the PR. PR #3896 - Fix Typescript generic typing for datasource contexts #3865 This is a fix for the
TContexttypings of the gateway's exposedGraphQLDataSourceimplementations. In their current form, they don't work as intended, or in any manner that's useful for typing thecontextproperty throughout the class methods. This introduces a type argumentTContextto the class itself (which defaults toRecord<string, any>for existing implementations) and removes the non-operational type arguments on the class methods themselves. - Implement retry logic for requests to GCS PR #3836 Note: coupled with this change is a small alteration in how the gateway polls GCS for updates in managed mode. Previously, the tick was on a specific interval. Now, every tick starts after the round of fetches to GCS completes. For more details, see the linked PR.
- Gateway issues health checks to downstream services via
serviceHealthCheckconfiguration option. Note: expected behavior differs between managed and unmanaged federation. See PR for new test cases and documentation. #3930
v0.13.2
- BREAKING: The behavior and signature of
RemoteGraphQLDataSource'sdidReceiveResponsemethod has been changed. No changes are necessary unless your implementation has overridden the default behavior of this method by either extending the class and overriding the method or by providingdidReceiveResponseas a parameter to theRemoteGraphQLDataSource's constructor options. Implementations which have provided their owndidReceiveResponseusing either of these methods should view the PR linked here for details on what has changed. PR #3743 - NEW: Setting the
apqoption totrueon theRemoteGraphQLDataSourcewill enable the use of automated persisted queries (APQ) when sending queries to downstream services. Depending on the complexity of queries sent to downstream services, this technique can greatly reduce the size of the payloads being transmitted over the network. Downstream implementing services must also support APQ functionality to participate in this feature (Apollo Server does by default unless it has been explicitly disabled). As with normal APQ behavior, a downstream server must have received and registered a query once before it will be able to serve an APQ request. #3744 - NEW: Experimental feature: compress downstream requests via generated fragments #3791 This feature enables the gateway to generate fragments for queries to downstream services in order to minimize bytes over the wire and parse time. This can be enabled via the gateway config by setting
experimental_autoFragmentization: true. It is currently disabled by default. - Introduce
make-fetch-happenpackage. RemovecachedFetcherin favor of the caching implementation provided by this package. #3783
v0.12.1
- Update to include fixes from
@apollo/federation.
v0.12.0
- Reduce interface expansion for types contained to a single service #3582
- Instantiate one
CachedFetcherper gateway instance. This resolves a condition where multiple federated gateways would utilize the same cache store could result in anExpected undefined to be a GraphQLSchemaerror. #3704 - Gateway: minimize downstream request size #3737
- experimental: Allow configuration of the query plan store by introducing an
experimental_approximateQueryPlanStoreMiBproperty to theApolloGatewayconstructor options which overrides the default cache size of 30MiB. #3755
v0.11.6
- Fix onSchemaChange callbacks for unmanaged configs #3605
v0.11.4
- Gateway over-merging fields of unioned types #3581
v0.11.0
- Begin supporting executable directives in federation #3464
v0.10.8
- Fix Gateway / Playground Query Plan view #3418
- Gateway schema change listener bug + refactor #3411 introduces a change to the
experimental_didUpdateCompositionhook andexperimental_pollIntervalconfiguration behavior.- Previously, the
experimental_didUpdateCompositionhook wouldn't be reliably called unless theexperimental_pollIntervalwas set. If it was called, it was sporadic and didn't necessarily mark the timing of an actual composition update. After this change, the hook is called on a successful composition update. - The
experimental_pollIntervalconfiguration option now affects both the GCS polling interval when gateway is configured for managed federation, as well as the polling interval of services. The former being newly introduced behavior.
- Previously, the
- Gateway cached DataSource bug #3412 introduces a fix for managed federation users where
DataSources wouldn't update correctly if a service's url changed. This bug was introduced with heavier DataSource caching in #3388. By inspecting theurlas well,DataSources will now update correctly when a composition update occurs. - Gateway - don't log updates on startup #3421 Fine tune gateway startup logging - on load, instead of logging an "update", log the service id, variant, and mode in which gateway is running.
v0.10.7
- Add export for experimental observability functions types. #3371
- Fix double instantiation of DataSources #3388
v0.10.6
- Fix debug query plan logging #3376
- Add
contextobject toGraphQLDataSource.didReceiveResponsearguments #3360
v0.10.1
- Make service definition cache local to ApolloGateway object #3191
- Fix value type behavior within composition and execution #3182
- Validate variables at the gateway level #3213
v0.9.1
- Optimize buildQueryPlan when two FetchGroups are on the same service #3135
- Construct and use RemoteGraphQLDataSource to issue introspection query to Federated Services #3120
v0.9.0
- Add experimental observability functions #3110
v0.8.2
- Handle
null@requires selections correctly during execution #3138
v0.6.13
- Proxy errors from downstream services #3019
- Handle schema defaultVariables correctly within downstream fetches #2963
v0.6.12
- Fix
@requiresbug preventing array and null values. PR #2928
v0.6.5
- Relax constraints of root operation type names in validation #2783
v0.6.2
- Resolve an issue with _proto_ pollution in deepMerge() #2779