From db39aa56048ecbec84dcf720b3726c8709af5cf4 Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Tue, 29 Jan 2019 11:39:08 +0200 Subject: [PATCH] =?UTF-8?q?Remove=20`willStart`=20from=20`apollo-server`,?= =?UTF-8?q?=20already=20called=20via=20`=E2=80=A6-express`.=20(#2239)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove `willStart` from `apollo-server`, already called via `...-express`. When the request pipeline was initially introduced, the integrations had yet to be updated to call the new life-cycle events. Now, the integrations have all caught up, but `apollo-server` is still calling `willStart`, despite the fact that its dependency which provides the actual server implementation — `apollo-server-express` – is _also_ calling it, resulting in double invocation of this event. I suspect some follow-up work should guard against this possibility, but for now this should remove the duplication. * Update CHANGELOG.md for #2239. Ref: https://github.com/apollographql/apollo-server/pull/2239 --- CHANGELOG.md | 3 ++- packages/apollo-server/src/index.ts | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdba8f8695b..4d027d31ede 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ### vNEXT -- Avoid traversing `graphql-uploads` module tree in run-time environments which aren't Node.js. [PR #2235](https://github.com/apollographql/apollo-server/pull/2235) +- `apollo-server` (only): Stop double-invocation of `serverWillStart` life-cycle event. (More specific integrations - e.g. Express, Koa, Hapi, etc. - were unaffected.) [PR #2239](https://github.com/apollographql/apollo-server/pull/2239) +- Avoid traversing `graphql-upload` module tree in run-time environments which aren't Node.js. [PR #2235](https://github.com/apollographql/apollo-server/pull/2235) ### v2.3.2 diff --git a/packages/apollo-server/src/index.ts b/packages/apollo-server/src/index.ts index 3daae6d646b..e92623fb9ee 100644 --- a/packages/apollo-server/src/index.ts +++ b/packages/apollo-server/src/index.ts @@ -78,8 +78,6 @@ export class ApolloServer extends ApolloServerBase { // Listen takes the same arguments as http.Server.listen. public async listen(...opts: Array): Promise { - await this.willStart(); - // This class is the easy mode for people who don't create their own express // object, so we have to create it. const app = express();