Update Apollo GraphQL packages to v3 (major)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| apollo-server | ^2.6.7 -> ^3.0.0 |
||||
| apollo-server-express | ^2.9.15 -> ^3.0.0 |
Release Notes
apollographql/apollo-server
v3.6.1
- Correctly remove dependency on
apollo-graphqlas intended in v3.6.0. Issue #5981 PR #5981
v3.6.0
apollo-server-core: Studio usage reporting now reports "referenced operations" for fields in addition to "field executions", which can be seen on the Studio Fields page. This new statistic provides visibility into uses of fields that are not executed. It is also more efficient to generate and (for Apollo Gateways) does not require subgraphs to support federated tracing. Additionally, the newfieldLevelInstrumentationoption toApolloServerPluginUsageReportingallows you to disable field-level tracing on a per-operation basis, and to report weights for operations to allow for estimates of the field execution count even when not all operations are instrumented. Note that the semantics of therequestContext.metrics.captureTracesfield have changed. See the Studio Fields page docs and thefieldLevelInstrumentationdocs for more details. Issue #5708 PR #5956 PR #5963apollo-server-core: Usage reporting no longer sends a "client reference ID" to Apollo Studio (along with the client name and client version). This little-used feature has not been documented since 2019 and is currently entirely ignored by Apollo Studio. This is technically incompatible as the interfaceClientInfono longer has the fieldclientReferenceId; if you were one of the few users who explicitly set this field and you get a TypeScript compilation failure upon upgrading to v3.6.0, just stop using the field. PR #5890apollo-server-core: Remove dependency onapollo-graphqlpackage (by inlining the code which generates usage reporting signatures). That package has not yet been published with agraphql@16peer dependency, so Apollo Server v3.5 did not fully supportgraphql@16without overriding peer dependencies. Issue #5941 PR #5955
v3.5.0
- Apollo Server now supports
graphql@16. (There is a very small backwards incompatibility:ApolloError.originalErrorcan no longer benull, matching the type ofGraphQLError.originalError. Useundefinedinstead. If this causes challenges, let us know and we can try to adapt.) PR #5857 -apollo-server-core: Fix build error when building with@rollup/plugin-commonjs. PR #5797 apollo-server-plugin-response-cache: Add missing dependency onapollo-server-types(broken since v3.0.0). Issue #5804 PR #5816apollo-server-core: The default landing page plugins now takedocument,variables, andheadersarguments which fill in default values if you click through to Explorer. PR #5711apollo-server-core: Support for HTTP request batching can now be disabled by passingallowBatchedHttpRequests: falsetonew ApolloServer. PR #5778 Issue #5686
v3.4.1
- ⚠️ SECURITY
apollo-server-core: Update default version of the GraphQL Playground React app loaded from the CDN to be@apollographql/[email protected]. This patches an XSS vulnerability. Note that if you are pinning the Playground React app version in your app withnew ApolloServer({plugins: [ApolloServerPluginLandingPageGraphQLPlayground({version: 'some version'})]}), you will need to update the specified version to 1.7.42 or later to avoid this vulnerability. If you do not explicitly enable GraphQL Playground via theApolloServerPluginLandingPageGraphQLPlaygroundplugin, this vulnerability does not affect you. See advisory GHSA-qm7x-rc44-rrqw for more details.
v3.4.0
apollo-server-core: You can now specify your ownDocumentStore(aKeyValueStore<DocumentNode>) for Apollo Server's cache of parsed and validated GraphQL operation abstract syntax trees via the newdocumentStoreconstructor option. This replaces theexperimental_approximateDocumentStoreMiBoption. You can replacenew ApolloServer({experimental_approximateDocumentStoreMiB: approximateDocumentStoreMiB, ...moreOptions})with:
PR #5644 Issue #5634import { InMemoryLRUCache } from 'apollo-server-caching'; import type { DocumentNode } from 'graphql'; new ApolloServer({ documentStore: new InMemoryLRUCache<DocumentNode>({ maxSize: Math.pow(2, 20) * approximateDocumentStoreMiB, sizeCalculator: InMemoryLRUCache.jsonBytesSizeCalculator, }), ...moreOptions, })apollo-server-core: For ease of testing, you can specify the node environment vianew ApolloServer({nodeEnv})in addition to via theNODE_ENVenvironment variable. The environment variable is now only read during server startup (and in some error cases) rather than on every request. PR #5657apollo-server-koa: The peer dependency onkoa(added in v3.0.0) should be a^range dependency rather than depending on exactly one version, and it should not be automatically increased when new versions ofkoaare released. PR #5759apollo-server-fastify: ExportApolloServerFastifyConfigandFastifyContextTypeScript types. PR #5743apollo-server-core: Only generate the schema hash once on startup rather than twice. PR #5757[email protected]: When choosing whether or not to parse a response as JSON, treat anycontent-typeending in+jsonas JSON rather than justapplication/hal+json(in addition toapplication/json). PR #5737apollo-server: You can now configure the health check URL path with thehealthCheckPathconstructor option, or disable serving health checks by passingnullfor this option. (This option is specific to the batteries-includedapollo-serverpackage; if you're using a framework integration package and want to serve a health check at a different path, just use your web framework directly.) PR #5270 Issue #3577apollo-server-azure-functions: This package now supports health checks like all of the other supported Apollo Server packages; they are on by default and can be customized withdisableHealthCheckandonHealthCheck. [PR #5003](https://github.com/apollographql/apollo-server/pull/50033) Issue #4925- Tests are no longer distributed inside published npm modules. PR #5799 Issue #5781
v3.3.0
apollo-server-core: Error handling when aserverWillStopcallback invoked byserver.stop()(orgateway.stop()) throws is now consistent: the original call toserver.stop()throws the error, and any concurrent and subsequent calls toserver.stop()throw the same error. Prior to Apollo Server v2.22.0, the original call threw the error and the behavior of concurrent and subsequent calls was undefined (in practice, it would call shutdown handlers a second time). Apollo Server v2.22.0 intended to put these semantics into place where all three kinds of calls would throw, but due to bugs, the original call would return without error and concurrent calls would hang. (Subsequent calls would correctly throw the error.) In addition, errors thrown by thedrainServerhook introduced in Apollo Server v3.2.0 are now handled in the same way. Issue #5649 PR #5653
v3.2.0
If you're using apollo-server-express or another framework integration, we highly recommend that you enable the new graceful shutdown feature after upgrading to 3.2.0. See the docs for ApolloServerPluginDrainHttpServer or the basic usage for your integration of choice.
apollo-server-core: Previously, only the batteries-includedapollo-serverpackage supported a graceful shutdown. Now the integrations support it as well, if you tell yourApolloServerwhich HTTP server to drain with the newApolloServerPluginDrainHttpServerplugin. This plugin implements a newdrainServerplugin hook. Forapollo-server-hapiyou can useApolloServerPluginStopHapiServerinstead. PR #5635apollo-server-core: Fixexperimental_approximateDocumentStoreMiBoption, which seems to have never worked before. PR #5629apollo-server-core: Only registerSIGINTandSIGTERMhandlers once the server successfully starts up; trying to callstopon a server that hasn't successfully started had undefined behavior. By default, don't register the handlers in serverless integrations, which don't have the same lifecycle as non-serverless integrations (eg, there's no explicitstartcall); you can still explicitly setstopOnTerminationSignalsto override this default. PR #5639
v3.1.2
apollo-server-core: Update versions of@graphql-tools/schemaand@graphql-tools/utilsfrom v7 to v8. While there is no change in behavior in these versions, a recently-released version of@graphql-tools/mockdepends on them, and so without this change, you typically end up with two copies of them installed.
v3.1.1
apollo-server-env: UpdateHeaders.values()type to match whatnode-fetchactually does and what the Fetch spec says it should be, and what@types/node-fetchfinally gets correct. PR #5537
v3.1.0
apollo-server-core: If a client does not provide a value or provides null for a variable declared to be non-null, this is now reported as an error with anextensions.codeofBAD_USER_INPUTrather thanINTERNAL_SERVER_ERROR. (This is similar to a change we made in v2.23.0 for variables that are sent as the wrong type.) PR #5508 Issue #5353apollo-server-core/apollo-server-plugin-base: Add support forschemaDidLoadOrUpdateevent hooks, to be specified by theserverWillStartevent hook. Plugins listening for this event will receive the API schema (and core schema for gateways) when the server's schema is initially loaded and when the server's schema is updated. For more information about this plugin event, see the plugin event reference documentation. PR #5187apollo-server-core: Add support for schema reporting when using Apollo Gateway. At the time of this package's release, Apollo Studio does not yet support schema reporting from gateways, so you should not use this feature yet for gateways (unless instructed otherwise by Apollo staff or by the Studio docs). If you do enable schema reporting for a gateway, the version of@apollo/gatewaymust be at least0.35.0, or elsestart()will error. PR #5187apollo-server-core: Support gateways without executors, to help with mocking gateways. Note that if you have a customGatewayInterfaceimplementation, Apollo Server will now honor theexecutorreturned fromloadand will ignore theexecutormethod on the gateway itself. See the PR for details. PR #5539apollo-server-plugin-response-cache,apollo-server-plugin-operation-registry: Change how the default export from the package is set up to fix errors with some build tools. PR #5542
v3.0.2
apollo-server-types: TypeScript typings forinfo.cacheControlare now added toGraphQLResolveInfoas part ofapollo-server-typesrather than a nested file inapollo-server-core, and the field now has a named type,ResolveInfoCacheControl. PR #5512apollo-server-micro: Like the other framework integrations, only serve landing pages from the GraphQL path (/graphqlby default, configurable via thepathoption tocreateHandler). PR #5516apollo-server-env: Remove polyfills ofObject.values,Object.entries, andutil.promisifywhich were only required for Node 6 support. RemoveValueOrPromiseandWithRequiredTypeScript types that are also provided byapollo-server-types. PR #5515
v3.0.1
apollo-server-core: The defaultmaxAge(which defaults to 0) for a field should only be applied if no dynamic cache control hint is set. Specifically, if you call the (new in 3.0.0) functioninfo.cacheControl.cacheHint.restrict({ maxAge: 60 }), it should setmaxAgeto 60 even if the default max age is lower. (This bug fix is the behavior that was intended for 3.0.0, and primarily affects the behavior of functions added in Apollo Server 3. This does mean that checkinginfo.cacheControl.cacheHintnow only shows explicitly-setmaxAgeand not the default, but this seems like it will be helpful since it lets you differentiate between the two similar circumstances.) PR #5492apollo-server-lambda: Fix TypeScript types forcontextfunction. (In 3.0.0, the TS types for thecontextfunction were accidentally inherited fromapollo-server-expressinstead of using the correct Lambda-specific types). PR #5481apollo-server-lambda,apollo-server-cloud-functions: Make the default URL path for handling GraphQL be/(ie, handle all requests). This is similar to how these packages work in Apollo Server 2. After this change,apollo-serverand the serverless integrations have a default URL path of/(or ignore the path entirely, in the case ofapollo-server-azure-functions), and the framework integrations have a default URL path of/graphql. This is a backwards-incompatible change from 3.0.1 but minimizes the changes from Apollo Server 2 (and this AS3 change was not intended or documented). PR #5497 Issue #5462
v3.0.0
BREAKING CHANGES
Apollo Server 3 contains quite a few breaking changes. Read our migration guide for more details on how to update your app.
Bumped dependencies
The minimum versions of these dependencies have been bumped to provide an improved foundation for the development of future features.
- Dropped support for Node.js v6, v8 and v10. Apollo Server 3.x is being compiled to ES2020, which maps to Node.js 12+.
- Note also that we only test Apollo Server on even-numbered versions of Node.js, and we only aim to support Node.js versions that are under long-term support from the Node.js Foundation.
- Dropped support for versions of the
graphqllibrary prior to15.3.0. - The
mocksoption of theApolloServerconstructor now uses@graphql-tools/mockv7 instead ofgraphql-toolsv4, which causes some breaking changes.- For example, mock functions no longer receive arguments and cannot return
Promises. - Note that some parts of the v7 migration guide suggest using the
resolversargument toaddMocksToSchema. Apollo Server does not support this option, but you can calladdMocksToSchemayourself and pass the result to theschemaoption of theApolloServerconstructor.
- For example, mock functions no longer receive arguments and cannot return
Removed functionality
Certain undersupported and underused Apollo Server features have been removed in favor of current or future methods for achieving similar functionality. Many of these features can be manually re-enabled, as listed below.
-
Dropped built-in partial support for subscriptions via the
subscriptions-transport-wspackage.- This integration did not support many Apollo Server features, and
subscriptions-transport-wshas not been actively maintained. - To re-enable subscriptions in Apollo Server 3 as they're supported in v2, see the migration guide.
- We hope to provide more deeply integrated subscription support in a future release.
- This integration did not support many Apollo Server features, and
-
Dropped built-in support for file uploads via the
graphql-uploadpackage.- To re-enable file uploads in Apollo Server 3 as they're supported in v2, see the migration guide.
-
Dropped support for the
graphql-extensionsAPI (e.g.,GraphQLExtensions,extensions) in favor of the Apollo Server plugins API. -
Dropped support for passing the
schemaDirectivesoption to theApolloServerconstructor.-
This option was passed directly to the
graphql-toolsfunctionmakeExecutableSchema. To continue using it, you can importmakeExecutableSchemafrom@graphql-tools/schemaand call it yourself:new ApolloServer({ schema: makeExecutableSchema({ typeDefs, resolvers, schemaDirectives }) })Note that
graphql-toolscalls this feature "legacy" schema directives, and you might want to consider the newerschemaTransformsoption instead.
-
-
Removed the deprecated
ApolloServer.schemafield, which never worked with federated gateways.- To extract your schema from your server, you can make a plugin with
serverWillStartor registeronSchemaChangeon your gateway.
- To extract your schema from your server, you can make a plugin with
-
apollo-datasource-rest: We no longer officially support overriding thebaseURLproperty with a getter, because TypeScript 4 does not allow you to do so. -
Removed the automatic addition of the
@cacheControldirective to schemas.- This directive was added in some circumstances but not in others, which caused confusion.
- If you use
@cacheControl, you can define it in your schema as shown in the docs.
-
Removed the
tracingoption passed to theApolloServerconstructor. The correspondingapollo-tracingpackage has been deprecated and is no longer being published.-
This package implemented an inefficient JSON format for execution traces returned via the
tracingGraphQL response extension. This format was only consumed by the deprecatedengineproxyand GraphQL Playground. -
If you rely on this trace format, the old version of
apollo-tracingshould still work:new ApolloServer({ plugins: [ require('apollo-tracing').plugin() ] });
-
-
Removed a redundant mechanism for applying extensions to an
ApolloError.- Applied extensions are now available only on
error.extensions, and are not also available onerroritself. - For details, see #5294.
- Relatedly, the
ForbiddenErrorandAuthenticationErrorconstructors now allow you to pass additional extensions.
- Applied extensions are now available only on
-
Removed the
cacheControloption passed to theApolloServerconstructor.- By default, Apollo Server continues to calculate an overall cache policy for each operation and sets the
Cache-ControlHTTP header. However, this is now implemented directly insideapollo-server-coreinstead of inside a separateapollo-cache-controlpackage (this package has been deprecated and is no longer being published). - Setting cache control options like
defaultMaxAgeis now done via the newly exportedApolloServerPluginCacheControlplugin, instead of as a top-level constructor option. This follows the same pattern as other built-in plugins like usage reporting. - The
CacheHintandCacheScopetypes are now exported fromapollo-server-types. Theinfo.cacheControl.cacheHintobject now has additional methods (replace,restrict, andpolicyIfCacheable), and its fields update when those methods orsetCacheHintare called. These methods also exist onrequestContext.overallCachePolicy, which is always defined and which should not be overwritten (usereplaceinstead). There is also a new functioninfo.cacheControl.cacheHintFromTypeavailable. @cacheControldirectives on type extensions are no longer ignored. Fields returning union types are now treated similarly to fields returning object and interface types (@cacheControldirectives on the type are honored, the defaultmaxAgeis applied to them).- New feature:
@cacheControl(inheritMaxAge: true)when applied to a composite type or a field returning a composite type means that the defaultmaxAgeis not applied to that field (unless it is a root field).
- By default, Apollo Server continues to calculate an overall cache policy for each operation and sets the
-
Due to conflicts with same/similar globals provided by
@types/supertest(which we use in our testing), some global TypeScript definitions have been removed fromapollo-server-envincluding that of, e.g.,fetch,RequestInfo,Headers,Request,Response,ResponseInit, and more. See the full list prior to removal here. Internally in the Apollo Server tests, for the time-being, we are relying on the same-named types from TypeScript'slib.dom.d.ts— e.g., itsRequestInfotype definition. For more details, see PR #5165. -
Top-level exports have changed. For example:
- We no longer re-export the entirety of
graphql-tools(includingmakeExecutableSchema) from all Apollo Server packages. To continue using them, installgraphql-toolsor one of its sub-packages yourself. - The
Uploadscalar is no longer exported as part of dropping built-in support for file uploads.
- We no longer re-export the entirety of
-
Stopped publishing the deprecated
apollo-server-testingpackage. This package is just a wrapper aroundserver.executeOperation, which you can use directly. -
apollo-server-caching: The test suite helper works differently, and theTestableKeyValueCacheinterface is removed. -
The
engineconstructor option,ENGINE_API_KEYenvironment variable, andENGINE_SCHEMA_TAGenvironment variables are no longer supported. Use theapolloconstructor option,APOLLO_KEYenvironment variable, andAPOLLO_GRAPH_VARIANTenvironment variable instead, as described in [theengineoption migration guide from v2.18)[https://www.apollographql.com/docs/apollo-server/v2/migration-engine-plugins/]. -
When you supply an Apollo API key via the
APOLLO_KEYenvironment variable ornew ApolloServer({apollo: {key}}), Apollo Server 3 no longer parses the key to guess your Studio graph ID. You must specify it yourself, either via theAPOLLO_GRAPH_IDenvironment variable (ornew ApolloServer({apollo: {graphId}})), or as a graph ref along with the variant (e.g.,your-graph-id@your-graph-variant) in theAPOLLO_GRAPH_REFenvironment variable (ornew ApolloServer({apollo: {graphRef}})).
Modified functionality
- With one exception, all Apollo Server plugin methods (
requestDidStart,didResolveOperation, etc.) are nowasync.- Previously, some of these methods were synchronous, others were
async, and some were "sometimes-async" by returning aValueOrPromise. - The exception is
willResolveField, which remains synchronous. This method is called much more often than any other plugin method, and converting it toasyncmight affect performance. - In a future release,
willResolveFieldmight become "sometimes-async" by returning aValueOrPromise.
- Previously, some of these methods were synchronous, others were
- Apollo Server now always fires the
willSendResponseplugin lifecycle event after firingdidEncounterError.- In certain error cases (mostly related to automated persisted queries), Apollo Server 2 skips firing
willSendResponse.
- In certain error cases (mostly related to automated persisted queries), Apollo Server 2 skips firing
- The
executionDidStartevent can no longer return a function as an "end hook". The "end hook" for this event now must be provided as an async function property calledexecutionDidEndon an object. - Renamed the
GraphQLServiceinterface toGatewayInterface.- This interface is the type used to provide a federated gateway instance to Apollo Server. Its name has been changed to reduce ambiguity.
- The previous name is still exported for backward compatibility purposes.
- Added support for serving a custom landing page at Apollo Server's base URL.
- Plugins can define a new
renderLandingPagehook that returns an HTML page to serve to browsers. - New plugins (
ApolloServerPluginLandingPageProductionDefaultandApolloServerPluginLandingPageLocalDefault) are installed by default (the former whenNODE_ENVisproduction, the latter otherwise) with instructions on how to communicate with the server, links to Apollo Sandbox, etc. - A new
ApolloServerPluginLandingPageGraphQLPlaygroundplugin can be installed instead to continue to use GraphQL Playground instead. Theplaygroundoption provided to theApolloServerconstructor has been removed; to customize GraphQL Playground you can provide an argument to the new playground plugin. By default, no GraphQL Playground settings are overridden, including the endpoint, which now defaults towindow.location.href(with most query parameters removed). This means you typically don't have to manually configure the endpoint when using GraphQL Playground. - To disable all landing pages, install the new
ApolloServerPluginLandingPageDisabledplugin. - Apollo Server packages no longer export
defaultPlaygroundOptions,PlaygroundConfig, orPlaygroundRenderPageOptions.
- Plugins can define a new
- Bad request errors (invalid JSON, missing body, etc) are more consistent across integrations and consistently return 4xx status codes instead of sometimes returning 5xx status codes.
- Setting
requestContext.response.http.statusnow affects successful GraphQL responses, not just errors.
Changes to Node.js framework integrations
-
When using a non-serverless framework integration (Express, Fastify, Hapi, Koa, Micro, or Cloudflare), you now must call
await server.start()before attaching the server to your framework.- This method was introduced in v2.22 but was optional prior to Apollo Server 3.
- This requirement does not apply to the
apollo-serverlibrary or to serverless framework integrations.
-
apollo-server-expressno longer officially supports using with theconnectframework.- We have not actively removed any
connectcompatibility code, and we do still test that it works withconnect. However, we reserve the right to break that compatibility without a major version bump of this package (we will certainly note in this changelog if we do so).
- We have not actively removed any
-
apollo-server-lambda: This package is now implemented as a wrapper aroundapollo-server-express.createHandler's argument now has different options:expressGetMiddlewareOptions, which includes options likecorsand is passed through toapollo-server-express'sgetMiddlewareexpressAppFromMiddleware, which lets you customize HTTP processing
Also, the
contextfunction now receives anexpress: { req, res }option in addition toeventandcontext -
apollo-server-lambda: The handler returned bycreateHandlercan now only be called as an async function returning aPromise(it no longer optionally accepts a callback as the third argument).- All current Lambda Node runtimes support this invocation mode (so
exports.handler = server.createHandler()will keep working without any changes). - If you've written your own handler that calls the handler returned by
createHandlerwith a callback, you'll need to handle itsPromisereturn value instead.
- All current Lambda Node runtimes support this invocation mode (so
-
apollo-server-lambda: Improved support for running behind an Application Load Balancer (ALB). -
apollo-server-fastifyis now compatible with Fastify v3 instead of Fastify v2. -
apollo-server-hapiis now only tested with Hapi v20.1.2 and higher (the minimum version that supports Node 16). -
The non-serverless integrations now depend on their corresponding web frameworks via peer dependencies rather than direct dependencies.
-
All integrations that allow CORS headers to be customized now default to
access-control-allow-origin: *. This was already the case forapollo-server, Express, Fastify, and Hapi; it is now also the same for Koa (which previously reflected the request's origin), Lambda, Cloud Functions, and Azure Functions as well (which did not set CORS by default). Micro and CloudFlare do not have a built-in way of setting CORS headers.
v2.25.3
- ⚠️ SECURITY
apollo-server-core: Update default version of the GraphQL Playground React app loaded from the CDN to be@apollographql/[email protected]. This patches an XSS vulnerability. Note that if you are pinning the Playground React app version in your app withnew ApolloServer({playground: {version: 'some version'}}), you will need to update the specified version to 1.7.42 or later to avoid this vulnerability. If you disable GraphQL Playground withnew ApolloServer({playground: false}), this vulnerability does not affect you. See advisory GHSA-qm7x-rc44-rrqw for more details.
v2.25.2
apollo-server-express: Update dependencies on@types/expressand@types/express-serve-static-core. PR #5352
v2.25.1
apollo-server-core,apollo-server-express: Upgradesubscriptions-transport-wsdependency and remove unneeded runtime dependency onws. This should enable you to install Apollo Server without depending on versions ofwsvulnerable to CVE-2021-32640. Note that the superficial integration of the unmaintainedsubscriptions-transport-wspackage will be removed in Apollo Server 3; you can also avoid this vulnerability by disabling the built-in subscription support withnew ApolloServer({subscriptions: false})and using a maintained package such asgraphql-wsinstead. (Instead of taking this upgrade, you can also upgradewsto5.2.3, which was just released.)
v2.25.0
apollo-server-core: You may now specify your Studio graph as a graph ref (id@variant) via theAPOLLO_GRAPH_REFenvironment variable ornew ApolloServer({apollo: {graphRef}})instead of specifying graph ID and graph variant separately. Theapolloobject passed to pluginserverWillStartand to gatewayloadnow contains agraphReffield.apollo-server-core: Fix a race condition where schema reporting could lead to a delay at process shutdown. PR #5222apollo-server-core: Allow the Fetch API implementation to be overridden for the schema reporting and usage reporting plugins via a newfetcheroption. PR #5179apollo-server-core: Theserver.executeOperationmethod (designed for testing) can now take itsqueryas aDocumentNode(eg, agql-tagged string) in addition to as a string. (This matches the behavior of theapollo-server-testingcreateTestClientfunction which is now deprecated.) We now recommend this method instead ofapollo-server-testingin our docs. Issue #4952apollo-server-testing: Replace README with a deprecation notice explaining how to useserver.executeOperationinstead. Issue #4952
v2.24.1
apollo-server-core: Fix a typo that could lead to TypeScript compilation when combined with a recent version of@types/node. (This bug had no runtime effect.) PR #5149
v2.24.0
apollo-server-core: Apollo Studio usage reporting uses a more efficient format which sends fewer detailed traces to Apollo's server. This change should not have a major effect on the experience of using Apollo Studio. This also fixes a bug in all prior versions where all operations were reported to Studio as "uncached". PR #4142
v2.23.0
apollo-server-core: Add optional argument toApolloServer.executeOperationallowing the caller to manually specify an argument to theconfigfunction analogous to that provided by integration packages. PR #4166 Issue #2886[email protected]: NewBaseRedisCacheclass which takes anioredis-compatible Redis client as an argument. The existing classesRedisCacheandRedisClusterCache(which pass their arguments toioredisconstructors) are now implemented in terms of this class. This allows you to use any of theioredisconstructor forms rather than just the ones recognized by our classes. This also fixes a long-standing bug where the Redis cache implementations returned a number fromdelete(); it now returns a number, matching what theKeyValueCacheinterface and the TypeScript types expect. PR #5034 PR #5088 Issue #4870 Issue #5006apollo-server-core: Fix type forformatResponsefunction. It never is called with anullargument, and is allowed to returnnull. Issue #5009 PR #5089apollo-server-lambda: Fix regression in v2.21.2 where thrown errors were replaced by throwing the JS Error class itself. PR #5085apollo-server-core: If a client sends a variable of the wrong type, this is now reported as an error with anextensions.codeofBAD_USER_INPUTrather thanINTERNAL_SERVER_ERROR. PR #5091 Issue #3498apollo-server-lambda: Explicitly support API GatewaypayloadFormatVersion2.0. Previously some codepaths did appropriate checks to partially support 2.0 and other codepaths could lead to errors likeevent.path.endsWith is not a function(especially since v2.21.1). Note that this changes the TypeScript typing of theonHealthCheckcallback passed tocreateHandlerto indicate that it can receive either type of event. If you are using TypeScript and care about having a precise typing for the argument to youronHealthCheckcallback, you should determine which payload format you want to support and writenew ApolloServer<APIGatewayProxyEvent>(...)ornew ApolloServer<APIGatewayProxyEventV2>(...)(importing these types fromaws-lambda), or differentiate between the two formats by checking to see if'path' in event. Issue #5084 Issue #5016
v2.22.2
apollo-server-core: Fix a regression in v2.22.0 where combiningapollo-server-corev2.22 with an older version of an integration package could lead to startup errors likecalled start() with surprising state invoking serverWillStart. The fix involves changing the semantics of the protectedwillStartmethod (which is left in only for backwards compatibility). Issue #5065 Issue #5066 PR #5073
v2.22.1
apollo-server-core: Fix a regression in v2.22.0 where startup errors could be thrown as part of the GraphQL response instead of redacted in one edge case. PR #5064
v2.22.0
- Improve startup error handling by ensuring that your server has loaded its schema and executed its
serverWillStarthandlers successfully before starting an HTTP server. If you're using theapollo-serverpackage, no code changes are necessary. If you're using an integration such asapollo-server-expressthat is not a "serverless framework", you can insertawait server.start()betweenserver = new ApolloServer()andserver.applyMiddleware. (If you don't callserver.start()yourself, your server will still work, but the previous behavior of starting a web server that may fail to load its schema still applies.) The serverless framework integrations (Lambda, Azure Functions, and Cloud Functions) do not support this functionality. While the protected methodwillStartstill exists for backwards compatibility, you should replace calls to it withstartor the new protected methodensureStarting. PR #4981
v2.21.2
apollo-server-core: TheSIGINTandSIGTERMsignal handlers installed by default (when not disabled bystopOnTerminationSignals: false) now stay active (preventing process termination) while the server shuts down, instead of letting a second signal terminate the process. The handlers still re-signal the process afterthis.stop()concludes. Also, ifthis.stop()throws, the signal handlers will now log and exit 1 instead of throwing an uncaught exception. Issue #4931apollo-server-lambda: Refactor the handler returned byserver.createHandlerso that if it is not passed a callback, it acts as an async handler instead of a non-async handler. This means you can wrap it in your own async handler without having to create a callback, and makes the code more maintainable. Issue #1989 PR #5004
v2.21.1
apollo-server-lambda: TheonHealthCheckoption did not previously work. Additionally, health checks (withonHealthCheckor without) didn't work in all Lambda contexts, such as behind Custom Domains; the path check is now more flexible. Issue #3999 PR #4969 Issue #4891 PR #4892- The
debugoption tonew ApolloServer(which adds stack traces to errors) now affects errors that come from requests executed withserver.executeOperation(and its wrapperapollo-server-testing), instead of just errors that come from requests executed over HTTP. Issue #4107 PR #4948 - Bump version of
@apollographql/graphql-playground-htmlto v1.6.27 and@apollographql/graphql-playground-reactto v1.7.39 to resolve incorrectly rendered CDN URL when Playgroundversionwasfalse-y. PR #4932 PR #4955 Issue #4937
v2.21.0
- Apollo Server can now be installed with
graphql@15without causing peer dependency errors or warnings. (Apollo Server has a file upload feature which was implemented as a wrapper around thegraphql-uploadpackage. We have been unable to upgrade our dependency on that package due to backwards-incompatible changes in later versions, and the version we were stuck on did not allowgraphql@15as a peer dependency. We have now switched to a fork of that old version called@apollographql/graphql-upload-8-forkthat allowsgraphql@15.) Also bump thegraphql-toolsdependency from 4.0.0 to 4.0.8 forgraphql@15support. Issue #4865
v2.20.0
apollo-server: Previously,ApolloServer.stop()functioned likenet.Server.close()in that it did not close idle connections or close active connections after a grace period. This meant that trying toawait ApolloServer.stop()could hang indefinitely if there are open connections. Now, this method closes idle connections, and closes active connections after 10 seconds. The grace period can be adjusted by passing the newstopGracePeriodMillisoption tonew ApolloServer, or disabled by passingInfinity(though it will still close idle connections). Note that this only applies to the "batteries-included"ApolloServerin theapollo-serverpackage with its own built-in Express and HTTP servers. PR #4908 Issue #4097apollo-server-core: When used withApolloGateway,ApolloServer.stopnow invokesApolloGateway.stop. (This makes sense becauseApolloServeralready invokesApolloGateway.loadwhich is what starts the behavior stopped byApolloGateway.stop.) Note that@apollo/gateway0.23 will expect to be stopped in order for natural program shutdown to occur. PR #4907 Issue #4428apollo-server-core: Avoid instrumenting schemas for the oldgraphql-extensionslibrary unless extensions are provided. PR #4893 Issue #4889[email protected]: TheshouldReadFromCacheandshouldWriteToCachehooks were always documented as returningValueOrPromise<boolean>(ie, that they could be either sync or async), but they actually only worked if they returned a bool. Now they can be either sync or async as intended. PR #4890 Issue #4886[email protected]: TheRESTDataSource.tracemethod is nowprotectedinstead ofprivateto allow more control over logging and metrics. PR #3940
Configuration
📅 Schedule: "before 2am" (UTC).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
- [ ] If you want to rebase/retry this PR, click this checkbox.
This PR has been generated by WhiteSource Renovate. View repository job log here.