Repository navigation
Avoid the redirect mode Workers rejects in directory search and reporting - #416
Merged
Merged
Conversation
…ting Workers accept only "follow" and "manual" redirects and reject redirect: "error" before sending. Node accepts it, so tests passed while hosted installations failed: - Company directory group search: the Entra token request and the Microsoft Graph search both failed, so every hosted Entra group search reported that the directory could not be queried. Both now use "manual"; their status checks already reject a redirect, so credentials never leave the directory's own endpoints. - Installation reporting, when enabled on Workers: batches never left. The transport uses "manual" and treats a redirect as a failed delivery. A workerd test runs the directory search in Miniflare and checks that its requests leave the runtime and that redirect targets are never requested.
Waiting for a body cancellation let a rejected cancellation replace the directory's error, skip dropping a token Graph rejected, and hold every later search behind a cancellation that never settles. Cleanup now runs in the background, in reporting too.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | f83a348 | Nov 25 2026, 09:28 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hosted Entra group search always failed with "The company directory could not be queried." Cloudflare Workers accepts only
redirect: "follow"and"manual"and throwsTypeError: Invalid redirect valuefor"error"before sending. Node accepts"error", so the existing tests passed. #414 fixed the same problem for profile pictures.Changes
directory.ts): the Entra token request and the Microsoft Graph group search useredirect: "manual". Both failed independently on Workers. Their existing status checks reject a 3xx, so credentials never leave the directory's own endpoints. Google Workspace is unaffected; it takes the group-email path.reporting.ts): the PostHog transport uses"manual". A 3xx fails the delivery, which the SDK handles like any failed send. With reporting enabled on Workers, no batch was ever sent.Node-only calls (
telemetry.ts,runtime-management-node.ts, the docs IndexNow script) keep"error".Tests
directory.worker.test.tsruns the directory search in workerd through Miniflare and records outbound requests. It covers a successful token request and Graph search, and redirects from either, whose targets receive no request. Both tests fail with"error"and pass with"manual".directory.test.ts: a token error whose body cancellation rejects still reports the authentication error, and after a Graph 401 whose cancellation never settles the next search gets a new token.reporting.integration.test.tsasserts the transport receivesredirect: "manual". A redirect case checks that the batch is attempted twice at the original URL, never at the target, and that both bodies are cancelled. It fails without the 3xx handling.

Confidence Score: 5/5
The PR appears safe to merge; no actionable issues remain.Summary
The PR makes directory search and installation reporting work on Workers without following redirects.
The previous unread-body concern is addressed: both directory failure branches call
cancel(). No new actionable issues were found.Reviews (3) · Last reviewed commit: "Release failed response bodies without w..." · Reviewed by Greptile