-
Notifications
You must be signed in to change notification settings - Fork 2k
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
gateway: Small improvements to error messages and behavior during updates. #3811
gateway: Small improvements to error messages and behavior during updates. #3811
Commits on Mar 3, 2020
-
Adjust deceiving error message about previous schemas and falling back.
This message was being issued when a new server starts up, prior to ever having a schema, when a storage secret (or any other artifact) can't be fetched from GCS (or any error within `updateServiceDefinitions`) despite the fact that there may be no `previousSchema`. While I could use `previousSchema` to change the error message, I don't think that it's this methods concern to decide what happens in the event of an error. I think it's only this methods concern to actually do the update, if it is in fact successful.
Configuration menu - View commit details
-
Copy full SHA for 06c3267 - Browse repository at this point
Copy the full SHA 06c3267View commit details -
Throw when updating the schema doesn't fail as expected.
Currently, we log the error and just return without throwing which causes `load` (one of two places where `updateComposition` is called to not actually fail and follow-up logic then suggests "Gateway successfully loaded schema", even though that cannot be true. The nice thing about this change (in addition to allowing someone to `catch` an error from `ApolloGateway.prototype.load`) is that this should bubble all the way up to the place where we currently call `load` within Apollo Server's constructor, and stop the server from starting in this failure condition: https://github.com/apollographql/apollo-server/blob/7dcee80ff33061c0911458d593ebbca5a9c73939/packages/apollo-server-core/src/ApolloServer.ts#L366 The other place we call `updateComposition` is within a `setTimeout`. That particular case is less troublesome since it will retry on the next interval.
Configuration menu - View commit details
-
Copy full SHA for 1655f4b - Browse repository at this point
Copy the full SHA 1655f4bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 827cba2 - Browse repository at this point
Copy the full SHA 827cba2View commit details -
Move "previous" variables closer to where they are used.
No need to have them so far away from their usage and to even do these assignments at all when there are already escape routes that exit this code path.
Configuration menu - View commit details
-
Copy full SHA for 7250bfe - Browse repository at this point
Copy the full SHA 7250bfeView commit details -
Align error messages with consistent terminology and add clarity.
* Refer to the thing we are processing consistently as "schema definitions". * Also make them generally more factual.
Configuration menu - View commit details
-
Copy full SHA for c1ee91e - Browse repository at this point
Copy the full SHA c1ee91eView commit details -
Configuration menu - View commit details
-
Copy full SHA for c3fb481 - Browse repository at this point
Copy the full SHA c3fb481View commit details -
Switch to using single argument logger usage and serialization.
Rely on `message` only if it's present, and fall back to serialization methods which might exist on the prototype otherwise (e.g. `toJSON`, `toString`). Also, switch to a single parameter usage of the logging facility. While `console.log` supports it, its certainly possible that the logger will _not_, and will need that positional parameter for something else.
Configuration menu - View commit details
-
Copy full SHA for e1d97d3 - Browse repository at this point
Copy the full SHA e1d97d3View commit details -
gateway: Trap unhandled promise rejections in polling.
While successful `updateComposition` invocations were working properly, failed invocations (including GCS access errors, network hiccups and just general configuration mistakes) were currently cluttering the logs with warnings of unhandled promise rejections. While those unhandled rejections did include the actual error messages, this adjusts them to be caught and logged in a structured manner with our `logger`, sparing our logs from those unnecessarily verbose (and scary!) messages.
Configuration menu - View commit details
-
Copy full SHA for da06fa8 - Browse repository at this point
Copy the full SHA da06fa8View commit details -
Remove incorrect comment about typings being an appropriate assertion.
Adjusting the typings only works for users of TypeScript. On the other hand, this is a one-time assertion which happens at instantiation time which could save a JavaScript developer from the pain of not knowing what's going on! There might be typing improvements to be had, but claiming it as an alternate approach to handling this isn't correct. The typings can still be improved, of course.
Configuration menu - View commit details
-
Copy full SHA for 88b87ea - Browse repository at this point
Copy the full SHA 88b87eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 846e59e - Browse repository at this point
Copy the full SHA 846e59eView commit details -
Use the same fetch response handling for the waterfall of GCS requests.
Overall, the success/failure behavior should be expected to be similar for all of these requests, as they all access the same GCS store.
Configuration menu - View commit details
-
Copy full SHA for ee4c9ac - Browse repository at this point
Copy the full SHA ee4c9acView commit details -
Do not prefix potentially the same error object on every request.
Sometimes, the error object which is being caught here is in fact not a misconfiguration of server options, but rather an error which was thrown in a promise chain. By appending the "Invalid options provided to ApolloServer" string to the error object's `message` property in this method that is called on _every_ request to the server (`runHttpQuery`), we're risking appending the same prefix to the same error over and over (i.e. "a: a: a: a: a: b"). While this prefix may have been true at one point, it is no longer possible to enforce in a world where the schema is obtained asynchronously.
Configuration menu - View commit details
-
Copy full SHA for d8c682b - Browse repository at this point
Copy the full SHA d8c682bView commit details -
Ensure the
executor
is set in gateway mode after failedload
reco……veries. Previously, if the initial call to `load` failed, but its intention (fetching a federated schema configuration in managed federation) is eventually accomplished via a subsequent fetch (via setInterval polling), the `executor` would not be set. This resulted in a continued failure even if the `schema` was eventually set since federated `schema`s require the Gateway's `executor` to do pull off their much more complex (remote!) execution strategy! The solution was simple since `executor` was already present on the actual `ApolloGateway`, but that required exposing that property as a valid type to access from the interface that `ApolloGateway` implements: `GraphQLService`. I don't see why a `GraphQLService` wouldn't have an executor, so it seemed appropriate to add, particularly since our only `GraphQLService` is the `ApolloGateway` class itself.
Configuration menu - View commit details
-
Copy full SHA for c473f88 - Browse repository at this point
Copy the full SHA c473f88View commit details -
Ensure that initial gateway
load
failures trap the downstream error.In particular, this blocks any rejected promises which may come from GCS load prior to returning them to the `schemaDerivedData` promise (which is where the `initSchema` method assigns the result to). Failure to do this results in the server middleware sending the error directly to the client.
Configuration menu - View commit details
-
Copy full SHA for a30bee7 - Browse repository at this point
Copy the full SHA a30bee7View commit details -
Allow other middleware (e.g. Playground) when initial Gateway load fa…
…ils. Another approach to this would be to throw an error here, but this is our only opportunity to allow the server to recover after initial failure. On the one hand, this approach is more graceful, but on the other hand, perhaps we actually want initial failure (after timeouts elapse) to not bind the other middleware. Either way, the server doesn't just `process.exit` right now, and with certain non-Node.js environments, it may be worthwhile to operate in this mode.
Configuration menu - View commit details
-
Copy full SHA for 99229fe - Browse repository at this point
Copy the full SHA 99229feView commit details -
Ensure the
executor
is still set onApolloServer
whenload
reje……cts. Because we want the actual executor to work when a schema might eventually become available, as it may when `onSchemaChange` hooks eventually succeed.
Configuration menu - View commit details
-
Copy full SHA for f878c7f - Browse repository at this point
Copy the full SHA f878c7fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f2fbff - Browse repository at this point
Copy the full SHA 4f2fbffView commit details -
Update packages/apollo-gateway/src/__tests__/gateway/executor.test.ts
Co-Authored-By: Trevor Scheer <trevor@apollographql.com>
Configuration menu - View commit details
-
Copy full SHA for 03038e3 - Browse repository at this point
Copy the full SHA 03038e3View commit details
Commits on Mar 4, 2020
-
Update packages/apollo-gateway/src/loadServicesFromStorage.ts
Co-Authored-By: Trevor Scheer <trevor@apollographql.com>
Configuration menu - View commit details
-
Copy full SHA for 4d4ab5b - Browse repository at this point
Copy the full SHA 4d4ab5bView commit details -
Revert "Update packages/apollo-gateway/src/loadServicesFromStorage.ts"
This reverts commit 4d4ab5b.
Configuration menu - View commit details
-
Copy full SHA for 0a50943 - Browse repository at this point
Copy the full SHA 0a50943View commit details -
Re-apply 4d4ab5b: apollo-gateway/src/loadServicesFromStorage.ts
To correct the syntax error. Co-Authored-By: Trevor Scheer <trevor@apollographql.com>
Configuration menu - View commit details
-
Copy full SHA for 554e20c - Browse repository at this point
Copy the full SHA 554e20cView commit details
Commits on Mar 6, 2020
-
chore(deps): update dependency gatsby-theme-apollo-docs to v4.0.13 (#…
…3856) Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for a75a366 - Browse repository at this point
Copy the full SHA a75a366View commit details -
Configuration menu - View commit details
-
Copy full SHA for 81a72e2 - Browse repository at this point
Copy the full SHA 81a72e2View commit details -
Change error message to not include word "lacks".
No particular reason, but I just didn't enjoy the previous wording (my own!).
Configuration menu - View commit details
-
Copy full SHA for 1400905 - Browse repository at this point
Copy the full SHA 1400905View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5dc847a - Browse repository at this point
Copy the full SHA 5dc847aView commit details -
Remove CHANGELOG.md annotations for pre-release version designators.
These have been released!
Configuration menu - View commit details
-
Copy full SHA for 3d3ed9d - Browse repository at this point
Copy the full SHA 3d3ed9dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c55de9 - Browse repository at this point
Copy the full SHA 0c55de9View commit details -
Configuration menu - View commit details
-
Copy full SHA for bba47c9 - Browse repository at this point
Copy the full SHA bba47c9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 264547c - Browse repository at this point
Copy the full SHA 264547cView commit details