github apollographql/apollo-server @apollo/server@6.0.0-alpha.0

Major Changes

  • #8252 c74f669 Thanks @glasser! - In order to use the cache control plugin, you must add a definition of the @cacheControl directive to your schema. The scope argument in the suggested directive definition used to be optional; the cache control plugin interprets an unspecified scope as PUBLIC. This default turns out to be surprising.

    In Apollo Server 6, we now suggest that you define the scope argument as required (scope: CacheControlScope!). By default, the cache control plugin (which is installed by default) will throw an error on startup if your schema defines a @cacheControl directive which does not match the suggested definition, including a non-null scope. You can disable this validation by installing ApolloServerPluginCacheControl({ validateDirectiveDefinition: false }) in your server's plugins array.

  • #8248 3eb55bd Thanks @glasser! - Remove the status400ForVariableCoercionErrors constructor option. Variable coercion errors always receive a 400 status code (the default since Apollo Server 5); setting the option to false is no longer supported.

  • #8272 66bd442 Thanks @glasser! - Previously, this published package contained copies compiled both as ECMAScript modules (ESM) and as CommonJS. It is now published only as ESM, without a CommonJS build. All supported versions of Node.js allow you to require() ESM code from CommonJS code.

    Even though Node.js's own module loader should be able to use this module from CommonJS code without configuration changes, other ways of running code might need small adjustments. Specifically, some configurations of Jest and TypeScript may need changes; see the migration guide for details.

    While Apollo Server v6.0.0 is ESM-only, it does not yet depend on any other ESM-only package at runtime. (This will make it easier to change our minds and return to publishing CommonJS builds if this change was premature.) However, we may choose to start depending on ESM-only packages in a future minor release.

  • #8246 89486b2 Thanks @glasser! - Require GraphQL.js v17. The graphql peer dependency is now ^17.1.0; Apollo Server 6 does not support GraphQL.js v16 (nor does it support pre-release versions of GraphQL.js v17, as Apollo Server 5 did experimentally). Before upgrading, read the GraphQL.js v16 to v17 upgrade guide for changes to GraphQL.js itself.

    Incremental delivery (@defer and @stream) now works natively without needing to install an alpha version of GraphQL.js. Clients must request incremental delivery with the accept: multipart/mixed; incrementalSpec=v0.2 HTTP header.

    Other packages that peer-depend on graphql must also accept v17; in particular, use @apollo/gateway v2.14.5 or later and @apollo/subgraph v2.16.0 or later.

  • #8250 39fe133 Thanks @glasser! - The hideSchemaDetailsFromClientErrors constructor option is removed, because GraphQL.js 17 now supports the same functionality natively. Replace new ApolloServer({ hideSchemaDetailsFromClientErrors: true }) with new ApolloServer({validationOptions: { hideSuggestions: true }}). Apollo Server will forward this flag to the GraphQL.js execution phase as well, so it now covers all "Did you mean ...?" suggestions GraphQL.js generates: previously hideSchemaDetailsFromClientErrors only removed suggestions from validation errors (for example, a query selecting an unknown field), but hideSuggestions also removes them from variable coercion errors (#8086), for example a misspelled input object field or enum value provided via variables.

  • #8247 069d645 Thanks @glasser! - Remove support for the legacy incremental delivery format (accept: multipart/mixed; deferSpec=20220824), along with the legacyExperimentalExecuteIncrementally constructor option. Operations that use @defer or @stream from clients that only accept that format now receive a 406 Not Acceptable error; clients should send accept: multipart/mixed; incrementalSpec=v0.2 instead.

    The GraphQLExperimental*Alpha2 and GraphQLExperimental*Alpha9 types are no longer exported from @apollo/server. GraphQLResponseBody and the willSendSubsequentPayload plugin hook now use the FormattedInitialIncrementalExecutionResult and FormattedSubsequentIncrementalExecutionResult types exported from graphql (which have the same shape as the removed Alpha9 types). GraphQLResponseBody's subsequentResults is now the AsyncGenerator that graphql returns (FormattedExperimentalIncrementalExecutionResults['subsequentResults']) rather than a plain AsyncIterable, so you can call return() on it.

  • #8244 0976350 Thanks @glasser! - Drop support for Node.js v20, which reached end-of-life on April 30, 2026. Apollo Server 6 requires Node.js v22.18.0 or later (engines.node: ">=22.18").

    Apollo Server 6 also adopts a new policy for Node.js support: once a Node.js major version reaches end-of-life, Apollo Server may drop support for it with a minor release rather than a major release. Such a change will be called out in the changelog. This policy only applies to Node.js versions, not other dependencies.

    Apollo Server is now compiled with TypeScript's es2024 target and lib (every supported Node.js version implements ES2024).

Minor Changes

  • #8251 7bafc03 Thanks @glasser! - Requests can now carry an AbortSignal. Web framework integrations can optionally include one in HTTPGraphQLRequest, and plugins can set or replace requestContext.request.http.signal in requestDidStart (for example, to combine the integration's signal with AbortSignal.timeout()). If a signal is present, Apollo Server checks it at several points while processing the request (such as before parsing, validation, and execution) and forwards it to GraphQL.js execution. Execution as a whole will stop early if the signal fires, and individual resolvers can access it via info.getAbortSignal() if they want to abort their own work. If the signal fires, requests will end with a new error code, REQUEST_ABORTED (for an incremental delivery response whose initial payload has already been sent, each still-pending deferred fragment or stream completes with that error).

    startStandaloneServer provides an AbortSignal and fires it if the client disconnects before the response is finished.

  • #8253 b9b39e6 Thanks @glasser! - When includeStacktraceInErrorResponses is enabled (the default outside production), the stacktrace extension now includes the stack traces of the error's whole cause chain, not only the error's own. After the error's own trace, each cause's trace follows, introduced by a Caused by: line. (As a special case, a cause whose stack is identical to its parent's is skipped; GraphQLErrors created with the deprecated originalError option instead of the standard cause option have this effect, and as of graphql@17.1.0, this includes errors thrown in resolvers.) So an error thrown in a context function now shows both where Apollo Server wrapped it and where it was thrown, and errors created with new Error(message, { cause }) show their causes.

    Relatedly, Apollo Server now builds the GraphQLErrors it creates (for parse, validation and variable-coercion failures, context-function and plugin errors, and request cancellation) with the standard JS cause option rather than with the GraphQL.js-specific now-deprecated originalError. This does not affect GraphQLErrors produced by graphql-js itself, such as the GraphQLError that wraps errors thrown within resolvers. On the error objects themselves, as seen by plugins (didEncounterErrors) and formatError, the stack of such a wrapping error now points at where Apollo Server wrapped it; the original error's stack can be found on error.cause.stack (as well as error.originalError.stack).

Patch Changes

  • #8249 6b2509d Thanks @glasser! - The "Too many errors processing variables" error that GraphQL.js produces when a request exceeds executionOptions.maxCoercionErrors now has the error code BAD_USER_INPUT (and a 400 status) instead of INTERNAL_SERVER_ERROR, like other variable coercion errors.

Don't miss a new apollo-server release

NewReleases is sending notifications on new releases.