Add fetch timeout and caching to supermemory-docs-mintlify proxy worker#1179
Conversation
Creates apps/docs-proxy/ - a new Cloudflare Worker that replaces the supermemory-docs-mintlify dashboard-deployed worker. Key improvements over the previous worker: - AbortController with 10-second timeout prevents indefinite hangs when Mintlify is slow (previous P99 reached 836 seconds) - Cache API (caches.default) caches successful GET responses for 5 minutes to reduce upstream load and improve response times - Returns 504 with a user-friendly message on timeout Worker proxies all requests to https://supermemory.mintlify.dev preserving original path, query string, method, headers, and body. Co-authored-by: Dhravya Shah <dhravya@supermemory.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 9b85bb2 | Jun 30 2026, 04:05 AM |
The project uses no-semicolons style per Biome configuration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 9b85bb2 | Commit Preview URL Branch Preview URL |
Jun 30 2026, 04:07 AM |
| const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS) | ||
|
|
||
| try { | ||
| const proxyRequest = new Request(proxyUrl, request) |
There was a problem hiding this comment.
new Request(proxyUrl, request) forwards all headers from the first-party request to the Mintlify upstream, including sensitive headers such as Cookie or Authorization. If this worker serves a Supermemory docs URL, domain-scoped cookies or client auth headers could be leaked upstream. Please construct a sanitized upstream header set and explicitly drop sensitive and hop-by-hop headers.
| @@ -0,0 +1,49 @@ | |||
| const UPSTREAM_BASE = "https://supermemory.mintlify.dev" | |||
There was a problem hiding this comment.
This new file is not Biome-formatted, and repo CI runs Biome on changed files. The delegated check reported biome ci fails with File content differs from formatting output; please format the file so CI passes.
|
Testing completed for PR #1179. Functional verification passed for the new docs proxy worker. Commands/checks reported by the testing subagent:
Coverage note from testing: there are no committed tests for the new worker behavior; the cache, timeout, and proxy behavior were validated with a one-off harness rather than checked-in tests. No screenshots or recordings were applicable because there were no UI changes. |
Summary
Creates a new Cloudflare Worker app at
apps/docs-proxy/to replace the existingsupermemory-docs-mintlifydashboard-deployed worker. The previous worker was a plain reverse proxy tohttps://supermemory.mintlify.devwith no timeout or caching, causing critical latency anomalies (P99 wall time reaching 836 seconds / ~14 minutes) when Mintlify is slow.Changes
New files:
apps/docs-proxy/src/index.ts— Worker implementationapps/docs-proxy/wrangler.jsonc— Wrangler config (name: supermemory-docs-mintlify)apps/docs-proxy/package.json— Package manifest (@repo/docs-proxy)apps/docs-proxy/tsconfig.json— TypeScript config for Cloudflare WorkersKey improvements
max-age=300)Implementation notes
caches.default(Cloudflare Cache API) — only caches successfulGETresponses withresponse.okAbortControllertimeout fires after 10 seconds; caughtAbortErrorreturns 504https://supermemory.mintlify.dev+ original path + query stringValidation
tsc --noEmit: passes with zero errorswrangler deploy --dry-run: "No bindings found. --dry-run: exiting now." (1.44 KiB upload)Deployment
This app is deployed independently — not wired into Turbo CI. To deploy:
cd apps/docs-proxy wrangler deploy --minifyAssumptions
supermemory-docs-mintlifyworker (dashboard-deployed) should be replaced/updated to point to this worker source after deploymentsrc/index.tswrangler.jsonc— assumes the existing worker already has the route configured in the Cloudflare dashboardSession Details
(aside)to your comment to have me ignore it.