[codex] Fix detached ArrayBuffer proxy DX#1985
Conversation
🦋 Changeset detectedLatest commit: 23b8b4e The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) 10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
❌ Some benchmark jobs failed:
Check the workflow run for details. |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests📦 Local Production (1 failed)express-stable (1 failed):
🐘 Local Postgres (2 failed)nextjs-turbopack-stable-lazy-discovery-disabled (1 failed):
nextjs-turbopack-stable-lazy-discovery-enabled (1 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
❌ 📦 Local Production
❌ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
| const DETACHED_ARRAYBUFFER_ERROR = | ||
| 'Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer'; | ||
| const PROXY_HANDLER_DOCS_URL = | ||
| 'https://useworkflow.dev/docs/getting-started/next#configure-proxy-handler'; |
There was a problem hiding this comment.
| 'https://useworkflow.dev/docs/getting-started/next#configure-proxy-handler'; | |
| 'https://workflow-sdk.dev/docs/getting-started/next#configure-proxy-handler'; |
There was a problem hiding this comment.
Pull request overview
Improves DX for the common "detached ArrayBuffer" failure mode where a Next.js proxy/middleware intercepts Workflow's internal /.well-known/workflow/* request, by upgrading the local queue's error log to actionable guidance, adding test coverage, surfacing the same hint in the Next.js getting-started docs, and making the relevant docs section directly linkable via URL hash.
Changes:
- Detect detached-ArrayBuffer errors (with cause-chain walk + cycle guard) in
world-localqueue's.catch()and replace the generic log with an actionable message + docs link, plus a regression test stubbingfetch. - Expand the v4/v5 Next.js getting-started "Configure Proxy Handler" accordion with a callout naming the exact error string, and give the accordion item an
h3anchor id (configure-proxy-handler). - Add a generic hash-open/scroll effect to the shared
Accordioncomponent so deep-links open the relevant accordion item; add a changeset for@workflow/world-local.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/world-local/src/queue.ts | Adds detached-ArrayBuffer detection and the actionable replacement log path in the queue's catch handler. |
| packages/world-local/src/queue.test.ts | Adds a regression test that stubs fetch to reject with a detached-ArrayBuffer cause and asserts the new log format. |
| docs/content/docs/v5/getting-started/next.mdx | Adds error-string callout and an id="configure-proxy-handler" anchor inside the accordion trigger. |
| docs/content/docs/v4/getting-started/next.mdx | Same docs changes applied to the v4 guide. |
| docs/components/ui/accordion.tsx | Adds a useEffect that opens and scrolls to the accordion item matching window.location.hash on mount and hashchange. |
| .changeset/sixty-plants-shout.md | Patch changeset for @workflow/world-local. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
@workflow/world-localqueue logging for theCannot perform ArrayBuffer.prototype.slice on a detached ArrayBufferfailure modeproxy.ts/middleware.tsmatcher fix when/.well-known/workflow/*is being interceptedRoot cause
When a Next.js proxy or middleware reads the request body for Workflow's internal
POST /.well-known/workflow/v1/flowrequest, the underlying ArrayBuffer can be detached before the executor reads it. The local queue then surfaces an undici-stylefetch failederror with a detached-ArrayBuffer cause, which is technically correct but not actionable enough on its own.What changed
packages/world-local/src/queue.tsfetchpathdocs/content/docs/v4/getting-started/next.mdxanddocs/content/docs/v5/getting-started/next.mdxCloses #1982
Validation
git diff --checkpnpm,npm,corepack, andnode_modulesare unavailable here