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.
🐛 Fixes
Fix router coprocessor deferred response buffering and change JSON body type from Object to String (Issue #3015)
The current implementation of the
RouterResponse
processing for coprocessors forces buffering of response data before passing the data to a coprocessor. This is a bug, because deferred responses should be processed progressively with a stream of calls to the coprocessor as each chunk of data becomes available.Furthermore, the data type was assumed to be valid JSON for both
RouterRequest
andRouterResponse
coprocessor processing. This is also a bug, because data at this stage of processing was never necessarily valid JSON. This is a particular issue when dealing with deferred (when using@defer
)RouterResponses
.This change fixes both of these bugs by modifying the router so that coprocessors are invoked with a
body
payload which is a JSONString
, not a JSONObject
. Furthermore, the router now processes each chunk of response data separately so that a coprocessor will receive multiple calls (once for each chunk) for a deferred response.For more details about how this works see the coprocessor documentation.
By @garypen in #3104
Experimental: Query plan cache keys now include a hash of the query and operation name (Issue #2998)
The experimental feature for caching query plans in a distributed store (e.g., Redis) will now create a SHA-256 hash of the query and operation name and include that hash in the cache key, rather than using the operation document as it was previously.
By @Geal in #3101
Federation v2.4.6 (Issue #3133)
This release bumps the Router's Federation support from v2.4.5 to v2.4.6, which brings in notable query planner fixes from v2.4.6. Of note from those releases, this brings query planner fixes that (per that dependency's changelog):
Fix assertion error in some overlapping fragment cases. In some cases, when fragments overlaps on some sub-selections (apollographql/federation#2594) and some interface field implementation relied on sub-typing, an assertion error could be raised with a message of the form
Cannot add selection of field X to selection set of parent type Y
and this fixes this problem.Fix possible fragment-related assertion error during query planning. This prevents a rare case where an assertion with a (apollographql/federation#2596) message of the form
Cannot add fragment of condition X (runtimes: ...) to parent type Y (runtimes: ...)
could fail during query planning.In addition, the packaging includes dependency updates for
bytes
,regex
,once_cell
,tokio
, anduuid
.By @Geal in #3135
Error redaction for subgraphs now respects disabling it
This follows-up on the new ability to selectively disable Studio-bound error redaction which was released in #3011 by fixing a bug which was preventing users from disabling that behavior on subgraphs. Redaction continues to be on by default and both the default behavior and the explicit
redact: true
option were behaving correctly.With this fix, the
tracing.apollo.errors.subgraph.all.redact
option set tofalse
will now transmit the un-redacted error message to Studio.By @bnjjj in #3137
Evaluate multiple keys matching a JWT criteria (Issue #3017)
In some cases, multiple keys could match what a JWT asks for (both the algorithm,
alg
, and optional key identifier,kid
). Previously, we scored each possible match and only took the one with the highest score. But even then, we could have multiple keys with the same score (e.g., collidingkid
between multiple JWKS in tests).The improved behavior will:
key
instead of the one with the highest score.alg
, withkid
present and matching, too), then we only test those keys.By @Geal in #3031
🛠 Maintenance
chore(deps):
xtask/
dependency updates (PR #3149)This is effectively running
cargo update
in thextask/
directory (our directory of tooling; not runtime components) to bring things more up to date.This changeset takes extra care to update
chrono
's features to remove thetime
dependency which is impacted by CVE-2020-26235, resolving a moderate severity which was appearing in scans. Again, this is not a runtime dependency and there was no actual/known impact to any users.By @abernix in #3149
Improve testability of the
state_machine
in integration testsWe have introduced a
TestRouterHttpServer
for writing more fine-grained integration tests in the Router core for the behaviors of the state machine.By @o0Ignition0o in #3099