Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: apollographql/apollo-server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: apollo-server@2.21.2
Choose a base ref
...
head repository: apollographql/apollo-server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: apollo-server@2.22.0
Choose a head ref
  • 14 commits
  • 72 files changed
  • 6 contributors

Commits on Mar 18, 2021

  1. Merge pull request #5037 from apollographql/release-2.21.2

    Release 2.21.2
    glasser authored Mar 18, 2021
    Copy the full SHA
    fe1bac4 View commit details

Commits on Mar 19, 2021

  1. docs: built-in uploads don't support Node 14, consider not using it (#…

    …5039)
    
    Also actually document the uploads option.
    
    Co-authored-by: Stephen Barlow <stephen@apollographql.com>
    glasser and Stephen Barlow authored Mar 19, 2021
    Copy the full SHA
    ecdca62 View commit details
  2. Remove an old link and improve language some

    Stephen Barlow authored and Stephen Barlow committed Mar 19, 2021
    Copy the full SHA
    ea9e4a8 View commit details
  3. Title tweak

    Stephen Barlow authored and Stephen Barlow committed Mar 19, 2021
    Copy the full SHA
    c0008d6 View commit details
  4. Merge pull request #5043 from apollographql/sb/auth-tweaks

    Remove an old link and improve language some
    Stephen Barlow authored Mar 19, 2021
    Copy the full SHA
    0b83fd2 View commit details

Commits on Mar 20, 2021

  1. chore(deps): update dependency @types/express-serve-static-core to v4…

    ….17.19 (#5045)
    
    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Mar 20, 2021
    Copy the full SHA
    b081cd0 View commit details
  2. chore(deps): update dependency @types/micro to v7.3.4 (#5046)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Mar 20, 2021
    Copy the full SHA
    99ade0f View commit details
  3. chore(deps): update dependency ts-jest to v26.5.4 (#5047)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Mar 20, 2021
    Copy the full SHA
    bbb5d3c View commit details

Commits on Mar 21, 2021

  1. chore(deps): update dependency @types/ioredis to v4.22.1 (#5048)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Mar 21, 2021
    Copy the full SHA
    dfb8672 View commit details
  2. Copy the full SHA
    91d779a View commit details

Commits on Mar 22, 2021

  1. Add async server.start() function (#4981)

    Previously, server startup worked like this:
    
    - `new ApolloServer`
      - If no gateway, calculate schema and schema derived data immediately
      - If gateway, kick off gateway.load from the end of the constructor, and if it
        async-throws, log an error once and make the server kinda broken forever
    - At various spots in the framework integration code, call (but don't await)
      the protected `willStart` function, which is an async function that first
      waits for the gateway to load the schema if necessary and then runs
      serverWillStart plugin functions; save the Promise returned by calling this.
    - At request time in the framework integration code, await that Promise.
      And also, if there's no schema, fail with an error.
    
    Now server startup works like this:
    - ApolloServer represents its state explicitly with a new ServerState
    - `new ApolloServer`
      - If no gateway, initialize all the schema-derived state directly like
        before (though the state now lives inside ServerState)
      - If gateway, the constructor DOES NOT KICK OFF `gateway.load()`
    - You can now call `await server.start()` yourself, which will first await
      `gateway.load` if necessary, and then await all serverWillStart calls.
    - If you're using `apollo-server` rather than an integration, `server.listen()`
      will just transparently do this for you; explicit `start()` is just for
      integrations!
    - Serverless frameworks also call it automatically for you in the background
      (kicked off by the constructor) because their startup has to be
      synchronous; if it fails then future requests will all fail (and log) as before.
    - The integration places that used to call willStart now call
      `server.ensureStarting()` instead which will kick off server.start in the
      background if you didn't (and log any errors thrown).
    - The places that used to await promiseWillStart no longer do so; generally
      right after that code we end up calling `graphqlServerOptions`
    - `graphqlServerOptions` now awaits `server.ensureStarted` which will start the
      server if necessary and throw if it threw.
    
    The overall change to user experience:
    - If you're using `apollo-server`, startup errors will cause `listen` to reject;
      no code changes are necessary.
    - If you're using a serverless integration, the behavior will be relatively similar,
      except that the startup error will be logged on all requests instead of just
      the first one.
    - If you're using an integration you are encouraged to call `await
      server.start()` yourself immediately after the constructor, which will let
      you detect startup errors.
    - But if you don't do that, the server will call `start` itself eventually. When
      you try to execute your first GraphQL request, `start` will happen if it
      hasn't already. Also an integration call like `server.applyMiddleware` will
      initiate a background `start`. If startup fails, the startup error will be
      logged on *every* failed graphql request, not just the first time like
      happened before.
    - If you have your own ApolloServer subclass that calls the protected
      `willStart` method, it will still work (the method isn't deleted) but you
      should rewrite it to either `await this.start()` or `this.ensureStarting()` instead.
    
    This is close enough to backwards-compatible to be appropriate for a v2 minor
    release. We are likely to make `start()` required in Apollo Server 3 for
    non-serverless integrations.
    
    Also:
    - Previously we used the deprecated `ApolloServer.schema` field to determine
      whether to install ApolloServerPluginInlineTrace, which we want to have active
      by default for federated schemas only. If you're using a gateway, this field
      isn't actually set at the time that ensurePluginInstantiation reads it.
      That's basically OK because we don't want to turn on the plugin automatically
      in the gateway, but in the interest of avoiding use of the deprecated field, I
      refactored it so that `ApolloServerPluginInlineTrace` is installed by default
      (ie, if you don't install your own version or install
      `ApolloServerPluginInlineTraceDisabled`) without checking the schema, and
      then (if it's installed automatically) it decides whether or not to be active
      by checking the schema at `serverWillStart` time.
    - Similarly, schema reporting now throws in its `serverWillStart` if the schema
      is federated, instead of in `ensurePluginInstantiation`. (This does mean that
      if you're not using the new `start()` or `apollo-server`, that failure won't
      make your app fail as fast as if the `ApolloServer` constructor threw.)
    - Fix some fastify tests that used a fixed listen port to not do that.
    - I am doing my best to never accidentally run `prettier` on whole files and
      instead to very carefully select specific blocks of the file to format them
      several times per minute. Apparently I screwed up once and ran it once on
      `packages/apollo-server-core/src/ApolloServer.ts`. The ratio of "prettier
      changes" to "actual changes" in that file is low enough that I'd rather just
      leave the changes in this PR rather than spending time carefully reverting
      them. (It's one of the files I work on the most and being able to keep it
      prettier-clean will be helpful anyway.)
    - Replace a hacky workaround for the lack of `start` in the op reg tests!
    - Replace a use of a `Barrier` class I added recently in tests with the
      `@josephg/resolvable` npm package, which does basically the same thing.
      Use that package in new tests and in the core state machine itself.
    - While running tests I found that some test files hung if run separately due to
      lack of cleanup. I ended up refactoring the cache tests to:
      - make who is responsible for calling cache.close more consistent
      - make the Redis client mocks self-contained mocks of the ioredis API instead
        of starting with an actual ioredis implementation and mocking out some
        internals
      - clean up Jest fake timers when a certain test is done
      I'm not super certain exactly which of these changes fixed the hangs but it
      does seem better this way. (Specifically I think the fake timer fix, which I
      did last, is what actually fixed it, but the other changes made it easier for
      me to reason about what was going on.) Can factor out into another PR if
      helpful.
    
    Fixes #4921. Fixes apollographql/federation#335.
    
    Co-authored-by: Stephen Barlow <stephen@apollographql.com>
    glasser and Stephen Barlow authored Mar 22, 2021
    Copy the full SHA
    a3282a2 View commit details
  2. CHANGELOG header for v2.22.0

    glasser committed Mar 22, 2021
    Copy the full SHA
    ce449b7 View commit details
  3. Release

     - apollo-cache-control@0.12.0-alpha.0
     - apollo-datasource-rest@0.11.0-alpha.0
     - apollo-datasource@0.8.0-alpha.0
     - apollo-server-azure-functions@2.22.0-alpha.0
     - apollo-server-cache-memcached@0.7.0-alpha.0
     - apollo-server-cache-redis@1.3.0-alpha.0
     - apollo-server-caching@0.6.0-alpha.0
     - apollo-server-cloud-functions@2.22.0-alpha.0
     - apollo-server-cloudflare@2.22.0-alpha.0
     - apollo-server-core@2.22.0-alpha.0
     - apollo-server-express@2.22.0-alpha.0
     - apollo-server-fastify@2.22.0-alpha.0
     - apollo-server-hapi@2.22.0-alpha.0
     - apollo-server-integration-testsuite@2.22.0-alpha.0
     - apollo-server-koa@2.22.0-alpha.0
     - apollo-server-lambda@2.22.0-alpha.0
     - apollo-server-micro@2.22.0-alpha.0
     - apollo-server-plugin-base@0.11.0-alpha.0
     - apollo-server-plugin-operation-registry@0.8.0-alpha.0
     - apollo-server-plugin-response-cache@0.7.0-alpha.0
     - apollo-server-testing@2.22.0-alpha.0
     - apollo-server-types@0.7.0-alpha.0
     - apollo-server@2.22.0-alpha.0
     - apollo-tracing@0.13.0-alpha.0
     - graphql-extensions@0.13.0-alpha.0
    glasser committed Mar 22, 2021
    Copy the full SHA
    1682a25 View commit details

Commits on Mar 25, 2021

  1. Release

     - apollo-cache-control@0.12.0
     - apollo-datasource-rest@0.11.0
     - apollo-datasource@0.8.0
     - apollo-server-azure-functions@2.22.0
     - apollo-server-cache-memcached@0.7.0
     - apollo-server-cache-redis@1.3.0
     - apollo-server-caching@0.6.0
     - apollo-server-cloud-functions@2.22.0
     - apollo-server-cloudflare@2.22.0
     - apollo-server-core@2.22.0
     - apollo-server-express@2.22.0
     - apollo-server-fastify@2.22.0
     - apollo-server-hapi@2.22.0
     - apollo-server-integration-testsuite@2.22.0
     - apollo-server-koa@2.22.0
     - apollo-server-lambda@2.22.0
     - apollo-server-micro@2.22.0
     - apollo-server-plugin-base@0.11.0
     - apollo-server-plugin-operation-registry@0.8.0
     - apollo-server-plugin-response-cache@0.7.0
     - apollo-server-testing@2.22.0
     - apollo-server-types@0.7.0
     - apollo-server@2.22.0
     - apollo-tracing@0.13.0
     - graphql-extensions@0.13.0
    glasser committed Mar 25, 2021
    Copy the full SHA
    93499e7 View commit details
Showing with 1,452 additions and 870 deletions.
  1. +4 −0 CHANGELOG.md
  2. +286 −99 docs/package-lock.json
  3. +1 −1 docs/package.json
  4. +57 −12 docs/source/api/apollo-server.md
  5. +10 −0 docs/source/data/file-uploads.md
  6. +16 −15 docs/source/data/subscriptions.mdx
  7. +1 −2 docs/source/deployment/azure-functions.md
  8. +1 −1 docs/source/deployment/netlify.md
  9. +20 −17 docs/source/integrations/middleware.md
  10. +45 −51 docs/source/security/authentication.md
  11. +45 −42 docs/source/security/terminating-ssl.md
  12. +29 −23 package-lock.json
  13. +4 −3 package.json
  14. +1 −1 packages/apollo-cache-control/package.json
  15. +1 −1 packages/apollo-datasource-rest/package.json
  16. +1 −1 packages/apollo-datasource/package.json
  17. +1 −1 packages/apollo-server-azure-functions/package.json
  18. +0 −6 packages/apollo-server-azure-functions/src/ApolloServer.ts
  19. +1 −1 packages/apollo-server-cache-memcached/package.json
  20. +3 −0 packages/apollo-server-cache-memcached/src/__tests__/Memcached.test.ts
  21. +1 −1 packages/apollo-server-cache-redis/package.json
  22. +43 −28 packages/apollo-server-cache-redis/src/__mocks__/ioredis.ts
  23. +4 −1 packages/apollo-server-cache-redis/src/__tests__/RedisCache.test.ts
  24. +1 −1 packages/apollo-server-caching/package.json
  25. +6 −1 packages/apollo-server-caching/src/__tests__/testsuite.ts
  26. +1 −1 packages/apollo-server-cloud-functions/package.json
  27. +0 −13 packages/apollo-server-cloud-functions/src/ApolloServer.ts
  28. +1 −1 packages/apollo-server-cloudflare/package.json
  29. +5 −1 packages/apollo-server-cloudflare/src/ApolloServer.ts
  30. +2 −1 packages/apollo-server-core/package.json
  31. +517 −273 packages/apollo-server-core/src/ApolloServer.ts
  32. +10 −11 packages/apollo-server-core/src/__tests__/ApolloServerBase.test.ts
  33. +32 −0 packages/apollo-server-core/src/plugin/inlineTrace/index.ts
  34. +33 −0 packages/apollo-server-core/src/plugin/schemaIsFederated.ts
  35. +12 −0 packages/apollo-server-core/src/plugin/schemaReporting/index.ts
  36. +53 −47 packages/apollo-server-express/README.md
  37. +2 −2 packages/apollo-server-express/package.json
  38. +5 −18 packages/apollo-server-express/src/ApolloServer.ts
  39. +5 −2 packages/apollo-server-express/src/__tests__/ApolloServer.test.ts
  40. +1 −0 packages/apollo-server-fastify/README.md
  41. +1 −1 packages/apollo-server-fastify/package.json
  42. +5 −3 packages/apollo-server-fastify/src/ApolloServer.ts
  43. +4 −1 packages/apollo-server-fastify/src/__tests__/ApolloServer.test.ts
  44. +6 −5 packages/apollo-server-fastify/src/__tests__/datasource.test.ts
  45. +1 −0 packages/apollo-server-hapi/README.md
  46. +1 −1 packages/apollo-server-hapi/package.json
  47. +4 −1 packages/apollo-server-hapi/src/ApolloServer.ts
  48. +4 −1 packages/apollo-server-hapi/src/__tests__/ApolloServer.test.ts
  49. +1 −1 packages/apollo-server-integration-testsuite/package.json
  50. +42 −21 packages/apollo-server-integration-testsuite/src/ApolloServer.ts
  51. +23 −33 packages/apollo-server-integration-testsuite/src/index.ts
  52. +27 −24 packages/apollo-server-koa/README.md
  53. +1 −1 packages/apollo-server-koa/package.json
  54. +5 −19 packages/apollo-server-koa/src/ApolloServer.ts
  55. +4 −1 packages/apollo-server-koa/src/__tests__/ApolloServer.test.ts
  56. +1 −1 packages/apollo-server-lambda/README.md
  57. +1 −1 packages/apollo-server-lambda/package.json
  58. +0 −13 packages/apollo-server-lambda/src/ApolloServer.ts
  59. +17 −11 packages/apollo-server-micro/README.md
  60. +1 −1 packages/apollo-server-micro/package.json
  61. +4 −5 packages/apollo-server-micro/src/ApolloServer.ts
  62. +1 −1 packages/apollo-server-plugin-base/package.json
  63. +1 −1 packages/apollo-server-plugin-operation-registry/package.json
  64. +11 −17 ...apollo-server-plugin-operation-registry/src/__tests__/ApolloServerPluginOperationRegistry.test.ts
  65. +1 −1 packages/apollo-server-plugin-response-cache/package.json
  66. +1 −1 packages/apollo-server-testing/package.json
  67. +1 −1 packages/apollo-server-types/package.json
  68. +1 −1 packages/apollo-server/package.json
  69. +9 −21 packages/apollo-server/src/__tests__/index.test.ts
  70. +10 −0 packages/apollo-server/src/index.ts
  71. +1 −1 packages/apollo-tracing/package.json
  72. +1 −1 packages/graphql-extensions/package.json
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -11,6 +11,10 @@ The version headers in this history reflect the versions of Apollo Server itself

> The changes noted within this `vNEXT` section have not been released yet. New PRs and commits which introduce changes should include an entry in this `vNEXT` section as part of their development. With few exceptions, the format of the entry should follow convention (i.e., prefix with package name, use markdown `backtick formatting` for package names and code, suffix with a link to the change-set à la `[PR #YYY](https://link/pull/YYY)`, etc.). When a release is being prepared, a new header will be (manually) created below and the appropriate changes within that release will be moved into the new section.
## v2.22.0

- Improve startup error handling by ensuring that your server has loaded its schema and executed its `serverWillStart` handlers successfully before starting an HTTP server. If you're using the `apollo-server` package, no code changes are necessary. If you're using an integration such as `apollo-server-express` that is not a "serverless framework", you can insert [`await server.start()`](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#start) between `server = new ApolloServer()` and `server.applyMiddleware`. (If you don't call `server.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 method `willStart` still exists for backwards compatibility, you should replace calls to it with `start` or the new protected method `ensureStarting`. [PR #4981](https://github.com/apollographql/apollo-server/pull/4981)

## v2.21.2

- `apollo-server-core`: The `SIGINT` and `SIGTERM` signal handlers installed by default (when not disabled by `stopOnTerminationSignals: 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 after `this.stop()` concludes. Also, if `this.stop()` throws, the signal handlers will now log and exit 1 instead of throwing an uncaught exception. [Issue #4931](https://github.com/apollographql/apollo-server/issues/4931)
Loading