Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.12.0 #3855

Merged
merged 91 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
3edfaed
typings: Accept `null` for DataLoader return types in RedisCache.
abernix Feb 10, 2020
07b00c9
Merge branch 'master' into abernix/dataloader-typings-in-redis-cache
abernix Feb 11, 2020
06ca1d2
changelog: Kick-off v2.12.0
trevor-scheer Mar 3, 2020
06c3267
Adjust deceiving error message about previous schemas and falling back.
abernix Feb 20, 2020
1655f4b
Throw when updating the schema doesn't fail as expected.
abernix Feb 20, 2020
827cba2
Adjust error message wording to be more concise.
abernix Feb 20, 2020
7250bfe
Move "previous" variables closer to where they are used.
abernix Feb 20, 2020
c1ee91e
Align error messages with consistent terminology and add clarity.
abernix Feb 20, 2020
c3fb481
logging: Raise severity from `warn` to `error` for what is certainly …
abernix Feb 21, 2020
e1d97d3
Switch to using single argument logger usage and serialization.
abernix Feb 24, 2020
da06fa8
gateway: Trap unhandled promise rejections in polling.
abernix Feb 24, 2020
88b87ea
Remove incorrect comment about typings being an appropriate assertion.
abernix Feb 24, 2020
846e59e
typings: Remove `any` type!
abernix Feb 24, 2020
ee4c9ac
Use the same fetch response handling for the waterfall of GCS requests.
abernix Feb 24, 2020
d8c682b
Do not prefix potentially the same error object on every request.
abernix Feb 24, 2020
c473f88
Ensure the `executor` is set in gateway mode after failed `load` reco…
abernix Feb 26, 2020
a30bee7
Ensure that initial gateway `load` failures trap the downstream error.
abernix Feb 26, 2020
99229fe
Allow other middleware (e.g. Playground) when initial Gateway load fa…
abernix Feb 26, 2020
f878c7f
Ensure the `executor` is still set on `ApolloServer` when `load` reje…
abernix Feb 27, 2020
4f2fbff
Expect the expected errors, rather than swallowing them.
abernix Feb 27, 2020
03038e3
Update packages/apollo-gateway/src/__tests__/gateway/executor.test.ts
abernix Mar 3, 2020
4d4ab5b
Update packages/apollo-gateway/src/loadServicesFromStorage.ts
abernix Mar 4, 2020
0a50943
Revert "Update packages/apollo-gateway/src/loadServicesFromStorage.ts"
abernix Mar 4, 2020
554e20c
Re-apply 4d4ab5b8: apollo-gateway/src/loadServicesFromStorage.ts
abernix Mar 4, 2020
81a72e2
Add comment to preserve concern about typings from @trevor-scheer.
abernix Mar 6, 2020
1400905
Change error message to not include word "lacks".
abernix Mar 6, 2020
5dc847a
Add more helpful error message and docs link to `fetchApolloGcs`.
abernix Mar 6, 2020
0c55de9
Merge remote-tracking branch 'origin/master' into release-2.12.0
abernix Mar 6, 2020
bba47c9
Merge branch 'release-2.12.0' into abernix/gateway-minor-qol-improvem…
abernix Mar 6, 2020
264547c
Add CHANGELOG.md for #3811.
abernix Mar 6, 2020
2094947
Merge pull request #3811 from apollographql/abernix/gateway-minor-qol…
abernix Mar 6, 2020
6597e39
apollo-server: Disable "x-powered-by" header (#3821)
pauloedurezende Mar 10, 2020
2562ad3
Fail to compose when a service's federated SDL cannot be retrie… (#3867)
abernix Mar 11, 2020
0976506
gateway: Warn when both local and remote configurations are pre… (#3868)
abernix Mar 12, 2020
afe1e9c
Merge remote-tracking branch 'origin/master' into release-2.12.0
abernix Mar 16, 2020
c4baaec
Switch multi-argument `logger` pattern to single parameter invocations.
abernix Mar 10, 2020
8a19ecc
Decompose `GatewayConfigBase` into types in preparation for `logger`.
abernix Mar 10, 2020
780d7f4
gateway: Introduce `Logger` type and expose on `logger` config.
abernix Mar 10, 2020
39913c3
tests: test various popular loggers: log4js, winston, bunyan, loglevel.
abernix Mar 10, 2020
ff20305
Add optional `logger` to `GraphQLServiceContext` and `GraphQLRequestC…
abernix Mar 13, 2020
a9f1d67
Introduce optional `logger` property for `apollo-engine-reporting`.
abernix Mar 13, 2020
eadcc6b
Introduce optional `logger` for `ApolloServer` class.
abernix Mar 13, 2020
0929c2f
To support Node.js 6, use older version of `log4js` for testing.
abernix Mar 16, 2020
2d43a74
ResponseCache: when available, use `requestContext.logger` to log.
abernix Mar 13, 2020
827a1b4
gateway: when set, log using `requestContext.logger` in `executeQuery…
abernix Mar 13, 2020
80a12d8
Make `logger` required on `GraphQLServiceContext` + `GraphQLRequestCo…
abernix Mar 13, 2020
ea3ecf0
Update CHANGELOG.md
abernix Mar 16, 2020
61f912d
Release
abernix Mar 16, 2020
fea6f15
Fix all the spelling mistakes.
abernix Mar 17, 2020
88c8ee8
Merge remote-tracking branch 'origin/release-2.12.0' into abernix/log…
abernix Mar 17, 2020
2461e98
Add CHANGELOG for #3894.
abernix Mar 17, 2020
6a5402f
docs: Explain `logger` on `ApolloServer` and `EngineReportingOptions`.
abernix Mar 17, 2020
c558ddd
Merge branch 'master' into abernix/dataloader-typings-in-redis-cache
trevor-scheer Mar 17, 2020
f6ba2de
Kinda revert "Decompose `GatewayConfigBase` into types in prep..."
abernix Mar 17, 2020
603608d
docs: Explain `logger` on `ApolloGateway` in the API reference.
abernix Mar 17, 2020
fefe7ff
Apply counter-intuitive severity to `debugPrintReports` messages.
abernix Mar 17, 2020
b32e1d1
docs: Note presence of `logger` in plugins' lifecycle hooks.
abernix Mar 17, 2020
4482da8
Fix typo in title of gateway CHANGELOG.
abernix Mar 17, 2020
656d3ff
Allow a user-provided `logger` for Server, Gateway and AER (#3894)
abernix Mar 17, 2020
c56129d
Merge pull request #3778 from apollographql/abernix/dataloader-typing…
abernix Mar 17, 2020
0ca43f8
Remove `loglevel-debug` and `DEBUG=apollo-gateway:*` support. (#3896)
abernix Mar 18, 2020
7422d70
Release
abernix Mar 18, 2020
78e6b8e
Update CHANGELOG.md
abernix Mar 18, 2020
8996158
Adjust schema rollback test for less flakiness
trevor-scheer Mar 19, 2020
faae806
Cleanup test variable name
trevor-scheer Mar 20, 2020
9a8d6c0
Merge remote-tracking branch 'origin/master' into release-2.12.0
abernix Mar 23, 2020
9d3f04e
apollo-engine-reporting: direct path string building (#3479)
pcarrier Mar 23, 2020
eeb1d00
Add CHANGELOG.md for #3479.
abernix Mar 23, 2020
01439c2
Align versions with other packages, after unintentionally skipping.
abernix Mar 23, 2020
34c7072
Release
abernix Mar 23, 2020
cdee9d6
Gateway: retry logic for requests to GCS (#3836)
trevor-scheer Mar 23, 2020
7ad9897
Fix various spelling mistakes, including one critical one!
abernix Mar 24, 2020
7e09cf2
plugins: Declare types rather than use in-line types for life-c… (#3902)
abernix Mar 26, 2020
152d6b8
Align versions prior to bumping together.
abernix Mar 26, 2020
3eaed42
Release
abernix Mar 26, 2020
903842e
Add `release:version-bump:server-and-federation` npm script.
abernix Mar 26, 2020
8b92435
Align versions prior to bumping version with lerna.
abernix Mar 26, 2020
8458017
Align versions prior to bumping to `-alpha.4`.
abernix Mar 26, 2020
a6189b3
Release
abernix Mar 26, 2020
8399a56
typo: Add missing "y" to "currentl".
abernix Mar 26, 2020
2d13545
Selectively import from `graphql`.
abernix Mar 26, 2020
efa9427
Gateway network testing cleanup
trevor-scheer Mar 30, 2020
33151b7
Leverage logger implementation in tests
trevor-scheer Mar 30, 2020
5eef2a6
Gateway downstream health checks (#3930)
trevor-scheer Apr 2, 2020
8647334
Bump `graphql` peerDependencies to `^15.0.0` (#3944)
trevor-scheer Apr 2, 2020
c69557b
Release
trevor-scheer Apr 2, 2020
7efa03f
CHANGELOG.md formatting.
abernix Apr 7, 2020
509d6a6
Adjust `CHANGELOG.md` prior to releasing.
abernix Apr 7, 2020
c68c577
Disable Node.js as a requirement for the publishing workflow.
abernix Apr 7, 2020
0d2bc78
Follow-up c68c577aa by completely disabling Node.js 6 tests.
abernix Apr 7, 2020
71a3863
Release
abernix Apr 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
# at https://hub.docker.com/r/circleci/node/.

# NODE: Note certain tests are currently being skipped for Node.js 6.
NodeJS 6:
executor: { name: oss/node, tag: '6' }
steps:
- common_test_steps
# NodeJS 6:
# executor: { name: oss/node, tag: '6' }
# steps:
# - common_test_steps

NodeJS 8:
executor: { name: oss/node, tag: '8' }
Expand Down Expand Up @@ -92,8 +92,8 @@ workflows:
version: 2
Build:
jobs:
- NodeJS 6:
<<: *common_non_publish_filters
# - NodeJS 6:
# <<: *common_non_publish_filters
- NodeJS 8:
<<: *common_non_publish_filters
- NodeJS 10:
Expand All @@ -104,15 +104,15 @@ workflows:
name: Package tarballs
<<: *common_non_publish_filters
requires:
- NodeJS 6
# - NodeJS 6
- NodeJS 8
- NodeJS 10
- NodeJS 12
- oss/dry_run:
name: Dry-run
<<: *common_publish_filters
requires:
- NodeJS 6
# - NodeJS 6
- NodeJS 8
- NodeJS 10
- NodeJS 12
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ The version headers in this history reflect the versions of Apollo Server itself
- [__CHANGELOG for `@apollo/gateway`__](https://github.com/apollographql/apollo-server/blob/master/packages/apollo-gateway/CHANGELOG.md)
- [__CHANGELOG for `@apollo/federation`__](https://github.com/apollographql/apollo-server/blob/master/packages/apollo-federation/CHANGELOG.md)

### v2.12.0

- `apollo-server-core`: Support providing a custom logger implementation (e.g. [`winston`](https://npm.im/winston), [`bunyan`](https://npm.im/bunyan), etc.) to capture server console messages. Though there has historically been limited output from Apollo Server, some messages are important to capture in the larger context of production logging facilities or can benefit from using more advanced structure, like JSON-based logging. This also introduces a `logger` property to the `GraphQLRequestContext` that is exposed to plugins, making it possible for plugins to leverage the same server-level logger, and allowing implementors to create request-specific log contexts, if desired. When not provided, these will still output to `console`. [PR #3894](https://github.com/apollographql/apollo-server/pull/3894)
- `apollo-server-core`: When operating in gateway mode using the `gateway` property of the Apollo Server constructor options, the failure to initialize a schema during initial start-up, e.g. connectivity problems, will no longer result in the federated executor from being assigned when the schema eventually becomes available. This precludes a state where the gateway may never become available to serve federated requests, even when failure conditions are no longer present. [PR #3811](https://github.com/apollographql/apollo-server/pull/3811)
- `apollo-server-core`: Prevent a condition which prefixed an error message on each request when the initial gateway initialization resulted in a Promise-rejection which was memoized and re-prepended with `Invalid options provided to ApolloServer:` on each request. [PR #3811](https://github.com/apollographql/apollo-server/pull/3811)
- `apollo-server-express`: Disable the automatic inclusion of the `x-powered-by: express` header. [PR #3821](https://github.com/apollographql/apollo-server/pull/3821)
- `apollo-engine-reporting`: Avoid creating new arrays when building trace trees. [PR #3479](https://github.com/apollographql/apollo-server/pull/3479)
- `apollo-server-core`: Bump `graphql` `peerDependencies` range to include `^15.0.0`. [PR #3944](https://github.com/apollographql/apollo-server/pull/3944)

### v2.11.0

- The range of accepted `peerDepedencies` versions for `graphql` has been widened to include `graphql@^15.0.0-rc.2` so as to accommodate the latest release-candidate of the `graphql@15` package, and an intention to support it when it is finally released on the `latest` npm tag. While this change will subdue peer dependency warnings for Apollo Server packages, many dependencies from outside of this repository will continue to raise similar warnings until those packages own `peerDependencies` are updated. It is unlikely that all of those packages will update their ranges prior to the final version of `graphql@15` being released, but if everything is working as expected, the warnings can be safely ignored. [PR #3825](https://github.com/apollographql/apollo-server/pull/3825)
Expand Down
34 changes: 31 additions & 3 deletions docs/source/api/apollo-gateway.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,19 @@ example of using `ApolloGateway`, see [The gateway](/federation/gateway/).
});
```

* `logger`: `Logger`

A logging implementation to be used in place of `console`. The implementation must provide the methods which satisfy the requirements of [the `Logger` interface](https://github.com/apollographql/apollo-server/blob/80a12d89ea1ae9a0892f4a81d9213eddf95ca965/packages/apollo-server-types/src/index.ts#L114-L121) (i.e. it must provide `debug`, `info`, `warn` and `error` methods). When a custom logger is provided, it will receive all levels of logging and it is up to the logger itself to determine how it wishes to handle each level. When a custom logger is _not_ provided, Gateway will default to outputting `warn` and `error` levels unless `debug: true` is specified, in which case it will output all log levels (i.e. `debug` through `error`).

Additionally, this `logger` will be made available on the `GraphQLRequestContext` and available to plugins. This allows a plugin to, e.g., augment the logger on a per-request basis within the `requestDidStart` life-cycle hook.

* `debug`: `Boolean`

If `true`, the gateway logs startup messages, along with the query plan for
each incoming request. The default value is `false`.

* `fetcher`: `typeof fetch`

When specified, overrides the default
[Fetch API](https://fetch.spec.whatwg.org/#fetch-api) implementation
which is used when communicating with downstream services. By default,
Expand All @@ -115,7 +121,7 @@ example of using `ApolloGateway`, see [The gateway](/federation/gateway/).
`fetcher: require('node-fetch')`) or different [default options for
`make-fetch-happen`](https://www.npmjs.com/package/make-fetch-happen#extra-options)
can be defined entirely. E.g.:

```javascript
const gateway = new ApolloGateway({
/* ... */
Expand All @@ -128,6 +134,14 @@ example of using `ApolloGateway`, see [The gateway](/federation/gateway/).
});
```

* `serviceHealthCheck`: `boolean`

When set to true, the gateway will issue a small query (`{ __typename }`) to
its downstream services on load and on schema update. On load, the gateway
will throw an error if any of the requests fail. On schema update, the
gateway will not roll over to the new schema or service configuration if any
of the requests fail, but it will try again at the next poll interval.

* `experimental_approximateQueryPlanStoreMiB`: `number`

> **This property is experimental.** It may be removed or change at any time, even within a patch release.
Expand All @@ -150,6 +164,20 @@ const server = new ApolloServer({
});
```

### `serviceHealthCheck`

Calling this function on the gateway will issue a small query (`{ __typename }`)
to each downstream service to ensure they are all responsive. This function
`throw`s on failure and returns a `Promise` to be `await`ed.

#### Parameters

* `serviceMap`: `DataSourceMap`

A map of data sources can optionally be provided to this function in order to
modify where the health checks will be issued. By default, the gateway will
use the existing `this.serviceMap` for issuing the health check requests.

## `RemoteGraphQLDataSource`

A `RemoteGraphQLDataSource` object represents a connection between your
Expand Down
10 changes: 10 additions & 0 deletions docs/source/api/apollo-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ new ApolloServer({
| AWS Lambda | <code>{<br/>&nbsp;&nbsp;event: [`APIGatewayProxyEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L78-L92),<br/>&nbsp;&nbsp;context: [`LambdaContext`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L510-L534)<br/>}</code> |
| Micro | <code>{ req: [`MicroRequest`](https://github.com/apollographql/apollo-server/blob/c356bcf3f2864b8d2fcca0add455071e0606ef46/packages/apollo-server-micro/src/types.ts#L3-L5), res: [`ServerResponse`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/node/v10/http.d.ts#L145-L158) }</code> |

* `logger`: `Logger`

A logging implementation to be used in place of `console`. The implementation must provide the methods which satisfy the requirements of [the `Logger` interface](https://github.com/apollographql/apollo-server/blob/80a12d89ea1ae9a0892f4a81d9213eddf95ca965/packages/apollo-server-types/src/index.ts#L114-L121) (i.e. it must provide `debug`, `info`, `warn` and `error` methods). When a custom logger is provided, it will receive all levels of logging and it is up to the logger itself to determine how it wishes to handle each level. When a custom logger is _not_ provided, Apollo Server will default to outputting `warn` and `error` levels unless `debug: true` is specified, in which case it will output all log levels (i.e. `debug` through `error`).

Additionally, this `logger` will be made available on the `GraphQLRequestContext` and available to plugins. This allows a plugin to, e.g., augment the logger on a per-request basis within the `requestDidStart` life-cycle hook.

* `rootValue`: <`Any`> | <`Function`>

A value or function called with the parsed `Document`, creating the root value passed to the graphql executor. The function is useful if you wish to provide a different root value based on the query operation type.
Expand Down Expand Up @@ -337,6 +343,10 @@ addMockFunctionsToSchema({
a service. You can also specify an API key with the `ENGINE_API_KEY`
environment variable, although the `apiKey` option takes precedence.

* `logger`: `Logger`

By default, this will inherit from the `logger` provided to `ApolloServer` which defaults to `console` when not provided. If specified within the `EngineReportingOptions` it can be used to send engine reporting to a separate logger. If provided, the implementation must provide the methods which satisfy the requirements of [the `Logger` interface](https://github.com/apollographql/apollo-server/blob/80a12d89ea1ae9a0892f4a81d9213eddf95ca965/packages/apollo-server-types/src/index.ts#L114-L121) (i.e. it must provide `debug`, `info`, `warn` and `error` methods).

* `calculateSignature`: (ast: DocumentNode, operationName: string) => string

Specify the function for creating a signature for a query.
Expand Down
23 changes: 16 additions & 7 deletions docs/source/integrations/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,15 @@ const server = new ApolloServer({

The `requestDidStart` event fires whenever Apollo Server begins fulfilling a GraphQL request.

```typescript
requestDidStart?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'request' | 'context' | 'logger'
>
): GraphQLRequestListener<TContext> | void;
```

This function can optionally return an object that includes functions for responding
to request lifecycle events that might follow `requestDidStart`.

Expand Down Expand Up @@ -318,7 +327,7 @@ does not occur.
parsingDidStart?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'metrics' | 'source'
'metrics' | 'source' | 'logger'
>,
): (err?: Error) => void | void;
```
Expand All @@ -338,7 +347,7 @@ available at this stage, because parsing must succeed for validation to occur.
validationDidStart?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'metrics' | 'source' | 'document'
'metrics' | 'source' | 'document' | 'logger'
>,
): (err?: ReadonlyArray<Error>) => void | void;
```
Expand All @@ -355,7 +364,7 @@ both the `operationName` string and `operation` AST are available.
didResolveOperation?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'metrics' | 'source' | 'document' | 'operationName' | 'operation'
'metrics' | 'source' | 'document' | 'operationName' | 'operation' | 'logger'
>,
): ValueOrPromise<void>;
```
Expand All @@ -371,7 +380,7 @@ are invoked in series, and the first non-null response is used.
responseForOperation?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'metrics' | 'source' | 'document' | 'operationName' | 'operation'
'metrics' | 'source' | 'document' | 'operationName' | 'operation' | 'logger'
>,
): ValueOrPromise<GraphQLResponse | null>;
```
Expand All @@ -385,7 +394,7 @@ GraphQL operation specified by a request's `document` AST.
executionDidStart?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'metrics' | 'source' | 'document' | 'operationName' | 'operation'
'metrics' | 'source' | 'document' | 'operationName' | 'operation' | 'logger'
>,
): (err?: Error) => void | void;
```
Expand All @@ -399,7 +408,7 @@ parsing, validating, or executing a GraphQL operation.
didEncounterErrors?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'metrics' | 'source' | 'errors'
'metrics' | 'source' | 'errors' | 'logger'
>,
): ValueOrPromise<void>;
```
Expand All @@ -414,7 +423,7 @@ if the GraphQL operation encounters one or more errors.
willSendResponse?(
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'metrics' | 'response'
'metrics' | 'response' | 'logger'
>,
): ValueOrPromise<void>;
```
Loading