This repository was archived by the owner on Sep 29, 2021. It is now read-only.
Update dependency apollo-server-express to v3 #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.








This PR contains the following updates:
2.25.2->3.1.2Release Notes
apollographql/apollo-server
v3.1.2Compare Source
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 tpyically end up with two copies of them installed.v3.1.1Compare Source
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 #5537v3.1.0Compare Source
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 #5542v3.0.2Compare Source
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 #5515v3.0.1Compare Source
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 #5462v3.0.0Compare Source
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.
graphqllibrary prior to15.3.0.mocksoption of theApolloServerconstructor now uses@graphql-tools/mockv7 instead ofgraphql-toolsv4, which causes some breaking changes.Promises.resolversargument toaddMocksToSchema. Apollo Server does not support this option, but you can calladdMocksToSchemayourself and pass the result to theschemaoption of theApolloServerconstructor.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.subscriptions-transport-wshas not been actively maintained.Dropped built-in support for file uploads via the
graphql-uploadpackage.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: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.serverWillStartor registeronSchemaChangeon your gateway.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.@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:Removed a redundant mechanism for applying extensions to an
ApolloError.error.extensions, and are not also available onerroritself.ForbiddenErrorandAuthenticationErrorconstructors now allow you to pass additional extensions.Removed the
cacheControloption passed to theApolloServerconstructor.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).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.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).@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).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:
graphql-tools(includingmakeExecutableSchema) from all Apollo Server packages. To continue using them, installgraphql-toolsor one of its sub-packages yourself.Uploadscalar is no longer exported as part of dropping built-in support for file uploads.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
requestDidStart,didResolveOperation, etc.) are nowasync.async, and some were "sometimes-async" by returning aValueOrPromise.willResolveField, which remains synchronous. This method is called much more often than any other plugin method, and converting it toasyncmight affect performance.willResolveFieldmight become "sometimes-async" by returning aValueOrPromise.willSendResponseplugin lifecycle event after firingdidEncounterError.willSendResponse.GraphQLServiceinterface toGatewayInterface.renderLandingPagehook that returns an HTML page to serve to browsers.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.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.ApolloServerPluginLandingPageDisabledplugin.defaultPlaygroundOptions,PlaygroundConfig, orPlaygroundRenderPageOptions.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.apollo-serverlibrary or to serverless framework integrations.apollo-server-expressno longer officially supports using with theconnectframework.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).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 processingAlso, the
contextfunction now receives anexpress: { req, res }option in addition toeventandcontextapollo-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).exports.handler = server.createHandler()will keep working without any changes).createHandlerwith a callback, you'll need to handle itsPromisereturn value instead.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.Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.