Hive Gateway v3 is out! It is built on GraphQL Yoga v6 and the latest major versions of GraphQL Tools, brings Federation contexts to the Rust Query Planner, and cleans up APIs that have been deprecated throughout v2.
Contextual Arguments with the Rust Query Planner
The Rust Query Planner supports the Federation
@context and @fromContext directives, just like Hive Router.
Nested fields can receive data from their ancestors without exposing it as a public argument:
Clients keep querying amount as is, and Hive Gateway fills in code from the currency of the
nearest User above each transaction. Entities whose ancestors hold different context values are
grouped by those values, and all groups are sent in a single subgraph request where every group
gets its own aliased _entities field. A list of users in 20 currencies still costs one round trip.
This applies to nullable contextual arguments, non-null ones are fetched with one request per group.
Request Correlation and Summaries
Hive Gateway uses the
request ID handling of Yoga v6.
A request ID your server framework already assigned to the request, like Fastify’s request.id, is
used first, so the gateway logs agree with the logs of your framework. The incoming x-request-id
header is not trusted by default, so clients cannot choose their own request IDs. If the gateway is
reachable only through a proxy that sets the header itself, you can trust it:
Every processed request is also summarized in a single info level log line with the operation,
the response status, the number of GraphQL errors and the request duration:
Faster JavaScript Query Planner
The JavaScript Query Planner no longer clones subgraphs for every group of computed or @requires
fields and for every merged type entry point. A subgraph is registered once, merges that used to be
split across clones are planned as one stage, and delegation plans are cached, also for types with
@requires fields.
On our federation benchmark, this resulted in about 7% higher throughput for Hive Gateway over HTTP, and in about 11% higher throughput for in-process stitching.
This is only the beginning. We have significantly more performance improvements lined up, but we are saving them for upcoming releases to avoid overcrowding v3.
Latest Incremental Delivery Spec
Following
Yoga v6,
clients can request the current graphql-js incremental delivery format for @defer and @stream
(using pending, id, subPath and completed) with an incrementalSpec parameter on the
Accept header:
The format is echoed back on the Content-Type header of the response. Clients sending a bare
multipart/mixed or deferSpec=20220824 keep receiving the legacy format, so existing clients are
unaffected.
Configurable Request Body Size Limit
The 25 MB request body size limit can be changed with the maxRequestBodySize option:
Execution and Upstream Cancellation by Default
Execution cancellation and
upstream cancellation are enabled
by default. When a client disconnects or aborts the request, Hive Gateway stops executing the
operation and aborts the in-flight subgraph requests, saving resources on both the gateway and the
subgraphs. You can opt out with executionCancellation: false and upstreamCancellation: false.
GraphQL-JS 17 Support
Hive Gateway and the stitching, wrapping and federation packages work with GraphQL-JS 17 alongside
16. The graphql peer dependency accepts both versions, so projects that install the packages
themselves keep the GraphQL version they already use.
The Docker images and the standalone binary come with graphql@17.1.0, so plugins, additional
resolvers, transforms and hooks loaded by the gateway configuration run against GraphQL-JS 17. Code
that only uses the gateway APIs needs no changes. If your custom code uses GraphQL internals
directly, check the
migration guide.
OpenTelemetry JS SDK 3
Hive Gateway and the OpenTelemetry plugin use OpenTelemetry JS SDK 3 and @opentelemetry/api 1.10.
The CLI options are unchanged, but custom OpenTelemetry setups have to use SDK 3 packages too.
@opentelemetry/sdk-trace replaces @opentelemetry/sdk-trace-base, the Logs API is part of
@opentelemetry/api, and the Jaeger exporter and propagator are gone in favour of OTLP and W3C Trace
Context. Check the migration guide
for the details.
NestJS 12 and @nestjs/platform-node
The NestJS driver supports NestJS 12 and
@nestjs/graphql 14, and works with the new @nestjs/platform-node HTTP adapter alongside Express
and Fastify. NestJS 10 and 11 are no longer supported. Since @nestjs/graphql 14 removed
subscriptions-transport-ws, subscriptions over WebSockets use graphql-ws. Check the
migration guide for the details.
Thank you to Jeff Fairley for the work on the NestJS 12 and
@nestjs/platform-node support.
Dropped Node.js 20 and GraphQL-JS 15
Node.js 20 has reached its end of life. Hive Gateway v3 requires Node.js 22.15 or later, and GraphQL-JS 16 or 17.
Removed Deprecated APIs
The following deprecated APIs have been removed:
- The
onDelegationPlanandonDelegationStageExecuteplugin hooks - The
loggerproperty of the transport context and theonFetchhook, in favour oflog - The
allowArbitraryOperationspersisted documents option, in favour ofallowArbitraryDocuments - Passing an array to the
rateLimitingoption, in favour ofrateLimiting: { config: [...] } - Passing an object to the
clientInfousage reporting option, in favour of a function - The
--hive-registry-tokenand--hive-usage-targetCLI options, in favour of--hive-targetand--hive-access-token
Read the migration guide for all the details.
- Migration guide from v2 to v3
- Rust Query Planner documentation
- Defer and Stream documentation
- Logging documentation
- Product update: Yoga v6
- Yoga v5 to v6 migration guide
- Pull request #2670: Hive Gateway v3
- Pull request #2703: Support
@contextand@fromContextwith Rust QP - Pull request #2763: Support GraphQL v17
- Pull request #2764: Support
@nestjs/platform-nodeand NestJS 12 - Pull request #2765: Upgrade OpenTelemetry to v3