Back the JWKS cache with the Workers edge cache - #1479
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | 8aa3e6c | Jul 28 2026, 07:20 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | 8aa3e6c | Commit Preview URL Branch Preview URL |
Jul 28 2026, 07:19 PM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
RhysSullivan
marked this pull request as ready for review
July 28, 2026 19:22
RhysSullivan
added a commit
that referenced
this pull request
Jul 28, 2026
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.
Cold isolates paid a full round trip to the WorkOS JWKS endpoint inside
workos.session.local_verifybefore serving their first request. An app-open burst fans out across many fresh isolates at once, so dozens of requests each stalled 1-2s in session verification simultaneously (traces:local_verifyp50 is 0ms warm, 1.0-1.9s in every open-the-app burst).Backs the in-memory JWKS cache with
caches.default: a cold isolate reads the key set from the datacenter-shared cache instead of the upstream endpoint, and the first isolate to fetch populates it for the rest. Force-refresh (key rotation) bypasses the shared copy, since it is exactly as stale as the in-memory one, and overwrites it with the fresh set. The edge layer is best-effort: read failures are cache misses, write failures are dropped, and node (tests) degrades to upstream-only automatically.Covered by new node tests: cold-isolate hit, miss-then-populate, malformed-entry fallthrough, rotation bypass-and-overwrite, and a failing cache backend.