Submit request bodies with CBOR encoding#844
Conversation
🦋 Changeset detectedLatest commit: fdf0013 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 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 |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests💻 Local Development (2 failed)astro-stable (2 failed):
🌍 Community Worlds (161 failed)mongodb (40 failed):
redis (40 failed):
starter (41 failed):
turso (40 failed):
Details by Category✅ ▲ Vercel Production
❌ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR switches the @workflow/world-vercel client from JSON to CBOR for all request bodies, aligning request encoding with the existing CBOR-based response handling. It also refactors the shared makeRequest utility to own body construction and simplifies call sites to pass typed data instead of pre-encoded payloads.
Changes:
- Add CBOR encoding for request bodies via
cbor-x.encodeinmakeRequest, and update headers to preferapplication/cbor. - Update
runs,steps,hooks, andeventsAPIs to pass high-leveldataobjects (includingserializeErroroutputs) intomakeRequestinstead of JSON strings. - Remove the now-unnecessary
dateToStringReplacerhelper and adjust imports accordingly, plus add a changeset entry for@workflow/world-vercel.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/world-vercel/src/utils.ts |
Adds CBOR request-body encoding in makeRequest, adjusts accepted/Content-Type headers, and (currently) overrides the workflow-server base URL to a specific preview deployment. |
packages/world-vercel/src/steps.ts |
Updates step creation and update calls to use makeRequest’s data parameter with CBOR, and uses serializeError for step error payloads. |
packages/world-vercel/src/runs.ts |
Switches workflow run create/update calls to pass structured data into makeRequest (including serializeError), relying on CBOR encoding. |
packages/world-vercel/src/hooks.ts |
Updates hook creation to pass a merged { runId, ...data } object as data into makeRequest for CBOR encoding and removes JSON-specific utilities. |
packages/world-vercel/src/events.ts |
Changes workflow-run event creation to send CBOR-encoded data via makeRequest and removes JSON-specific plumbing. |
.changeset/eighty-bikes-jog.md |
Records a patch release note for @workflow/world-vercel describing the CBOR encoding change for request bodies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| headers.set('X-Request-Time', Date.now().toString()); | ||
|
|
||
| // Encode body as CBOR if data is provided | ||
| let body: Buffer | undefined; |
There was a problem hiding this comment.
body is typed as Buffer | undefined, but encode from cbor-x returns a Uint8Array, which is not assignable to Buffer in TypeScript and also unnecessarily couples this helper to Node-specific types. To avoid type errors and keep this utility usable in edge/runtime environments, consider typing body as a BodyInit | null (or at least Uint8Array | undefined) and letting the Fetch implementation accept the binary payload directly.
| let body: Buffer | undefined; | |
| let body: BodyInit | null | undefined; |
f673bf0 to
fdf0013
Compare
…s-and-commands * origin/main: fix(@workflow/ai): support provider-executed tools (AI SDK v6) (#734) Publish "workflow" and "@workflow/core" package versions in sync (#870) Add SDK version to workflow run executionContext for observability (#868) Allow recreateRun to accept an optional deploymentId parameter (#869) Add support for top-level `using` declarations inside of step / workflow functions (#866) docs: URL in docs was missing the docs/ prefix, 404 errors (#852) Add "classes" object to `manifest.json` file (#864) Fix Nest workbench app build (#865) Ignore Astro on local dev tests for source map e2e tests (#863) Enable custom class serialization transformations for "client" mode (#860) Submit request bodies with CBOR encoding (#844) [world-vercel] Update queue to use VQS v3 API (#799) NestJS framework support (#840) Fix resolve hook theming and token fetching. (#856) docs: rename Control Flow Patterns to Common Patterns and add new content (#846) docs: revamp World documentation pages (#763) Remove unused `getWritable` stub function (#855) # Conflicts: # packages/core/package.json # pnpm-lock.yaml

Updated request body encoding to use CBOR instead of JSON for all API requests in the
@workflow/world-vercelpackage.What changed?
dateToStringReplacerfunction as it's no longer needed with CBOR encodingmakeRequestutility to handle CBOR encoding of request bodiesrequestDatato avoid confusion with thedataparameter inmakeRequestWhy make this change?
CBOR encoding provides several advantages over JSON:
This change maintains API compatibility while improving the underlying transport mechanism.