Skip to content

[builders] Switch Vercel Build Output API from CJS to ESM#1562

Merged
VaguelySerious merged 14 commits intomainfrom
peter/esm-builders
Apr 8, 2026
Merged

[builders] Switch Vercel Build Output API from CJS to ESM#1562
VaguelySerious merged 14 commits intomainfrom
peter/esm-builders

Conversation

@VaguelySerious
Copy link
Copy Markdown
Member

@VaguelySerious VaguelySerious commented Mar 30, 2026

Summary

  • Switches the default output format for step, workflow (final wrapper), and webhook bundles from CJS to ESM
  • VercelBuildOutputAPIBuilder now emits .mjs files with "type": "module" in package.json and "handler": "index.mjs" in .vc-config.json
  • The StandaloneBuilder inherits the new ESM defaults automatically
  • The intermediate workflow bundle (which runs inside vm.runInContext) remains CJS — the only place where CJS is genuinely required
  • Removes the CJS import.meta.url polyfill from the webhook bundle (no longer needed with ESM output)

Motivation

Every framework-specific local builder (Next.js, SvelteKit, Astro, NestJS, Nitro, Vitest) already overrides the format to ESM. The Vercel Build Output API builder and standalone builder were the only ones still defaulting to CJS, which caused import.meta.url to be undefined at runtime — breaking libraries like Prisma that rely on it (#1507).

The CJS polyfill from #1509 fixed the symptom but this PR fixes the root cause: there's no reason these bundles need CJS since Vercel serverless functions fully support ESM.

Supersedes #1509.

Test plan

  • @workflow/builders tests pass (115/115)
  • @workflow/core tests pass (499/499)
  • Typecheck passes across all 41 packages
  • Example workbench builds and produces correct ESM output with "type": "module" and "handler": "index.mjs"
  • Verified step bundle contains no CJS polyfill (__import_meta_url) and uses native ESM
  • CI e2e tests
  • Verify deployed preview functions work correctly

Closes #1507

🤖 Generated with Claude Code

The step, workflow, and webhook bundles produced by
VercelBuildOutputAPIBuilder and the standalone builder now default
to ESM format instead of CJS. This preserves native import.meta.url
support, fixing issues with libraries like Prisma that rely on it.

The intermediate workflow bundle (which runs inside vm.runInContext)
remains CJS — the only place where CJS is genuinely required.

Closes #1507

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 30, 2026

🦋 Changeset detected

Latest commit: 2a01a03

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@workflow/builders Patch
@workflow/cli Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/vitest Patch
workflow Patch
@workflow/world-testing Patch
@workflow/nuxt Patch
@workflow/ai Patch
@workflow/core Patch
@workflow/web-shared Patch

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 890 0 67 957
✅ 💻 Local Development 866 0 178 1044
✅ 📦 Local Production 866 0 178 1044
✅ 🐘 Local Postgres 866 0 178 1044
✅ 🪟 Windows 79 0 8 87
❌ 🌍 Community Worlds 16 61 8 85
✅ 📋 Other 219 0 42 261
Total 3802 61 659 4522

❌ Failed Tests

🌍 Community Worlds (61 failed)

mongodb-dev (1 failed):

  • dev e2e should rebuild on imported step dependency change

redis-dev (1 failed):

  • dev e2e should rebuild on imported step dependency change

turso-dev (1 failed):

  • dev e2e should rebuild on imported step dependency change

turso (58 failed):

  • addTenWorkflow | wrun_01KNQ70C3APPQCCDKDZKYR293W
  • addTenWorkflow | wrun_01KNQ70C3APPQCCDKDZKYR293W
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNQ72BH6E306P0K6BNB2XGC3
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNQ70J09NX5DG58M45EP8ZRG
  • promiseRaceWorkflow | wrun_01KNQ70P3P7PX0G8YHQ2YB1D19
  • promiseAnyWorkflow | wrun_01KNQ70QYTHG7MGFSGACKYWWTK
  • importedStepOnlyWorkflow | wrun_01KNQ72PAPVQ34C17AM75SG7MS
  • hookWorkflow | wrun_01KNQ713HYC8V9W73HFGGJA6AA
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNQ71DYXC69QP60QRBHWZ87T
  • webhookWorkflow | wrun_01KNQ71Q034D5AQ0W91NV2V5WK
  • sleepingWorkflow | wrun_01KNQ71YHD1JQQBJ3TNHW4GTH2
  • parallelSleepWorkflow | wrun_01KNQ72ANQMC41H61MKY9MS94Y
  • nullByteWorkflow | wrun_01KNQ72HARTKWPVN28YW4JDK60
  • workflowAndStepMetadataWorkflow | wrun_01KNQ72KB8Q3YJY32FAJ353Y9S
  • fetchWorkflow | wrun_01KNQ75C07NEWD8G8P5ET2FPNS
  • promiseRaceStressTestWorkflow | wrun_01KNQ75F1FM57ZBN9SZ12REFEZ
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNQ791P7G8FVCWKQ9ESBKBHS
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNQ79MQH6ZW4JRTM4GBYAGQH
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNQ7A8800873R16TSN5WH5YJ
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNQ7AVT0DPWXSCDB86YC57Z3
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNQ7B3K4EF2WRHCMT97BKY7P
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNQ7B8H3TJ9MK4BP5RTFEQMJ
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNQ7BABBV75MYPAH920HK8CY
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNQ7BR2KTPC22Z2JHJ15S2S6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNQ7BZ4DW8QE13A1NYKCKWS0
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNQ7C9KPMKV2RHZB55HAQD23
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNQ7CFK6K9KZEMNJPWYC0BGY
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNQ7CNJGY6R2KT0TRFB0DCVW
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNQ7CWKT23ZVKG1MYA582DE1
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNQ7D2V4SY0C9F387H5QBB08
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNQ7DETAJ8S4KP6M7ZNRTQF5
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNQ7DQ5QYVBHVV03SXBG9N3D
  • cancelRun - cancelling a running workflow | wrun_01KNQ7DX38X86K3JH5KCSPPWQS
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNQ7E6CCBYT1W1X7GQ87W53V
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNQ7EHH8YT0NMWGTMVVEE54C
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNQ7F4PFQ5C9NSJ2S8BP9VW8
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNQ7FECRBA161Z0CS6N32R9K
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNQ7FMB5AA34267DFCFDPNDE
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNQ7FP6Y8HKD73PJETVD4DEG
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KNQ7FRQJDHG3VEK371P8RDA4
  • getterStepWorkflow - getter functions with "use step" directive | wrun_01KNQ7FWT6TP92X2X97GP1WK8Y

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 80 0 7
✅ example 80 0 7
✅ express 80 0 7
✅ fastify 80 0 7
✅ hono 80 0 7
✅ nextjs-turbopack 85 0 2
✅ nextjs-webpack 85 0 2
✅ nitro 80 0 7
✅ nuxt 80 0 7
✅ sveltekit 80 0 7
✅ vite 80 0 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 73 0 14
✅ express-stable 73 0 14
✅ fastify-stable 73 0 14
✅ hono-stable 73 0 14
✅ nextjs-turbopack-canary 62 0 25
✅ nextjs-turbopack-stable 79 0 8
✅ nextjs-webpack-canary 62 0 25
✅ nextjs-webpack-stable 79 0 8
✅ nitro-stable 73 0 14
✅ nuxt-stable 73 0 14
✅ sveltekit-stable 73 0 14
✅ vite-stable 73 0 14
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 73 0 14
✅ express-stable 73 0 14
✅ fastify-stable 73 0 14
✅ hono-stable 73 0 14
✅ nextjs-turbopack-canary 62 0 25
✅ nextjs-turbopack-stable 79 0 8
✅ nextjs-webpack-canary 62 0 25
✅ nextjs-webpack-stable 79 0 8
✅ nitro-stable 73 0 14
✅ nuxt-stable 73 0 14
✅ sveltekit-stable 73 0 14
✅ vite-stable 73 0 14
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 73 0 14
✅ express-stable 73 0 14
✅ fastify-stable 73 0 14
✅ hono-stable 73 0 14
✅ nextjs-turbopack-canary 62 0 25
✅ nextjs-turbopack-stable 79 0 8
✅ nextjs-webpack-canary 62 0 25
✅ nextjs-webpack-stable 79 0 8
✅ nitro-stable 73 0 14
✅ nuxt-stable 73 0 14
✅ sveltekit-stable 73 0 14
✅ vite-stable 73 0 14
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 79 0 8
❌ 🌍 Community Worlds
App Passed Failed Skipped
❌ mongodb-dev 4 1 0
❌ redis-dev 4 1 0
❌ turso-dev 4 1 0
❌ turso 4 58 8
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 73 0 14
✅ e2e-local-postgres-nest-stable 73 0 14
✅ e2e-local-prod-nest-stable 73 0 14

📋 View full workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 0.041s (-8.6% 🟢) 1.006s (~) 0.965s 10 1.00x
💻 Local Express 0.043s (+2.6%) 1.005s (~) 0.962s 10 1.06x
🐘 Postgres Express 0.058s (+4.9%) 1.010s (~) 0.952s 10 1.43x
🐘 Postgres Nitro 0.061s (~) 1.010s (~) 0.949s 10 1.51x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 0.278s (+9.9% 🔺) 2.515s (-3.4%) 2.237s 10 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 1.127s (~) 2.005s (~) 0.878s 10 1.00x
💻 Local Nitro 1.128s (~) 2.007s (~) 0.879s 10 1.00x
🐘 Postgres Express 1.138s (-0.8%) 2.010s (~) 0.872s 10 1.01x
🐘 Postgres Nitro 1.143s (~) 2.010s (~) 0.867s 10 1.01x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.647s (+38.2% 🔺) 4.395s (+17.4% 🔺) 1.748s 10 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 10.873s (-0.6%) 11.025s (~) 0.152s 3 1.00x
🐘 Postgres Nitro 10.904s (~) 11.021s (~) 0.117s 3 1.00x
💻 Local Express 10.929s (~) 11.023s (~) 0.094s 3 1.01x
💻 Local Nitro 10.941s (-0.7%) 11.025s (-2.9%) 0.084s 3 1.01x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 16.552s (-2.6%) 18.485s (-2.6%) 1.932s 2 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 25 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 14.528s (-0.7%) 15.024s (~) 0.496s 4 1.00x
🐘 Postgres Nitro 14.564s (~) 15.022s (~) 0.458s 4 1.00x
💻 Local Express 15.004s (~) 15.279s (+1.7%) 0.275s 4 1.03x
💻 Local Nitro 15.021s (~) 15.531s (-1.6%) 0.509s 4 1.03x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 36.114s (+16.7% 🔺) 37.745s (+15.0% 🔺) 1.631s 2 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 50 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 13.842s (-1.9%) 14.021s (-4.9%) 0.179s 7 1.00x
🐘 Postgres Express 13.909s (-1.2%) 14.163s (-4.8%) 0.254s 7 1.00x
💻 Local Nitro 16.687s (-1.7%) 17.031s (-1.9%) 0.344s 6 1.21x
💻 Local Express 16.733s (+1.8%) 17.031s (~) 0.297s 6 1.21x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 56.017s (+3.1%) 57.788s (+3.3%) 1.771s 2 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 1.263s (-1.1%) 2.009s (~) 0.746s 15 1.00x
🐘 Postgres Express 1.263s (~) 2.009s (~) 0.746s 15 1.00x
💻 Local Nitro 1.542s (-0.7%) 2.006s (~) 0.464s 15 1.22x
💻 Local Express 1.543s (-1.0%) 2.006s (-3.2%) 0.463s 15 1.22x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.236s (+37.0% 🔺) 4.876s (+11.0% 🔺) 1.640s 7 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 2.337s (~) 3.010s (~) 0.673s 10 1.00x
🐘 Postgres Nitro 2.377s (+1.3%) 3.009s (~) 0.632s 10 1.02x
💻 Local Nitro 2.970s (-5.9% 🟢) 3.760s (-6.3% 🟢) 0.790s 8 1.27x
💻 Local Express 3.011s (+6.2% 🔺) 3.455s (+11.2% 🔺) 0.445s 9 1.29x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 6.331s (+133.2% 🔺) 8.261s (+78.6% 🔺) 1.930s 4 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

Promise.all with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 3.437s (-0.8%) 4.010s (~) 0.574s 8 1.00x
🐘 Postgres Nitro 3.462s (~) 4.008s (~) 0.546s 8 1.01x
💻 Local Nitro 7.815s (-12.7% 🟢) 8.769s (-5.4% 🟢) 0.955s 4 2.27x
💻 Local Express 8.433s (+4.2%) 9.022s (+5.8% 🔺) 0.589s 4 2.45x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.298s (+1.2%) 4.768s (-7.0% 🟢) 1.470s 8 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 1.246s (~) 2.008s (~) 0.762s 15 1.00x
🐘 Postgres Express 1.253s (~) 2.008s (~) 0.754s 15 1.01x
💻 Local Express 1.531s (+1.6%) 2.006s (~) 0.474s 15 1.23x
💻 Local Nitro 1.585s (+1.1%) 2.006s (~) 0.422s 15 1.27x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.128s (~) 4.064s (+4.4%) 1.936s 8 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 2.308s (~) 3.008s (~) 0.700s 10 1.00x
🐘 Postgres Nitro 2.330s (~) 3.010s (~) 0.680s 10 1.01x
💻 Local Express 3.059s (-13.3% 🟢) 3.884s (-9.6% 🟢) 0.825s 8 1.33x
💻 Local Nitro 3.404s (+8.2% 🔺) 4.135s (+3.1%) 0.732s 8 1.47x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.315s (-8.5% 🟢) 4.069s (-11.8% 🟢) 1.754s 8 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

Promise.race with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 3.453s (~) 4.009s (~) 0.556s 8 1.00x
🐘 Postgres Nitro 3.483s (+0.8%) 4.009s (~) 0.526s 8 1.01x
💻 Local Nitro 8.644s (-7.1% 🟢) 9.026s (-10.0% 🟢) 0.382s 4 2.50x
💻 Local Express 9.046s (+2.4%) 9.776s (+5.4% 🔺) 0.730s 4 2.62x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.705s (-6.1% 🟢) 4.467s (-3.6%) 1.762s 7 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.823s (-7.7% 🟢) 1.006s (-5.0% 🟢) 0.183s 60 1.00x
🐘 Postgres Nitro 0.848s (+0.5%) 1.006s (~) 0.159s 60 1.03x
💻 Local Express 0.988s (+1.4%) 1.178s (+5.6% 🔺) 0.190s 52 1.20x
💻 Local Nitro 0.990s (-2.5%) 1.230s (-31.7% 🟢) 0.240s 49 1.20x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 9.223s (+1.3%) 11.740s (+5.8% 🔺) 2.517s 6 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.979s (~) 2.402s (+3.8%) 0.424s 38 1.00x
🐘 Postgres Nitro 2.056s (+1.3%) 2.976s (+5.5% 🔺) 0.920s 31 1.04x
💻 Local Express 3.033s (+2.0%) 3.649s (+12.0% 🔺) 0.616s 25 1.53x
💻 Local Nitro 3.057s (-0.9%) 3.843s (-4.2%) 0.785s 24 1.55x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 29.498s (+2.5%) 31.887s (+4.5%) 2.389s 3 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 4.087s (~) 4.810s (+3.1%) 0.723s 25 1.00x
🐘 Postgres Nitro 4.149s (-0.7%) 4.852s (-3.2%) 0.703s 25 1.02x
💻 Local Nitro 9.150s (-3.0%) 9.942s (-0.8%) 0.792s 13 2.24x
💻 Local Express 9.248s (+2.1%) 10.019s (+4.8%) 0.770s 12 2.26x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 80.716s (+7.6% 🔺) 83.165s (+8.5% 🔺) 2.450s 2 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.281s (+1.1%) 1.007s (~) 0.726s 60 1.00x
🐘 Postgres Nitro 0.287s (+0.5%) 1.007s (~) 0.720s 60 1.02x
💻 Local Nitro 0.586s (-5.8% 🟢) 1.004s (-1.7%) 0.418s 60 2.09x
💻 Local Express 0.590s (-0.9%) 1.004s (~) 0.414s 60 2.10x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 1.684s (-14.0% 🟢) 3.799s (-12.6% 🟢) 2.114s 16 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.502s (+3.2%) 1.007s (~) 0.505s 90 1.00x
🐘 Postgres Nitro 0.521s (+3.4%) 1.007s (~) 0.486s 90 1.04x
💻 Local Nitro 2.548s (-1.8%) 3.009s (~) 0.461s 30 5.08x
💻 Local Express 2.677s (+7.3% 🔺) 3.181s (+5.7% 🔺) 0.504s 29 5.33x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.941s (+5.5% 🔺) 5.030s (+6.2% 🔺) 2.089s 18 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.796s (-0.9%) 1.008s (~) 0.212s 120 1.00x
🐘 Postgres Nitro 0.865s (+8.1% 🔺) 1.037s (+2.0%) 0.173s 116 1.09x
💻 Local Nitro 11.091s (-4.0%) 11.755s (-2.3%) 0.664s 11 13.94x
💻 Local Express 11.138s (+0.9%) 11.756s (+2.4%) 0.618s 11 14.00x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 7.557s (+25.4% 🔺) 9.785s (+26.4% 🔺) 2.228s 13 1.00x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express

Stream Benchmarks (includes TTFB metrics)
workflow with stream

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.197s (-3.2%) 0.998s (~) 0.001s (+16.7% 🔺) 1.010s (~) 0.813s 10 1.00x
🐘 Postgres Nitro 0.204s (+1.5%) 0.994s (~) 0.002s (-11.8% 🟢) 1.010s (~) 0.806s 10 1.04x
💻 Local Express 0.206s (+3.0%) 1.005s (~) 0.012s (+5.1% 🔺) 1.019s (~) 0.812s 10 1.05x
💻 Local Nitro 0.208s (-2.8%) 1.004s (~) 0.011s (-12.4% 🟢) 1.018s (~) 0.810s 10 1.06x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 1.615s (-36.7% 🟢) 3.173s (-22.2% 🟢) 0.862s (+236.4% 🔺) 4.447s (-6.9% 🟢) 2.833s 10 1.00x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.620s (-5.0% 🟢) 1.022s (+1.8%) 0.004s (-26.6% 🟢) 1.040s (+1.6%) 0.420s 58 1.00x
🐘 Postgres Nitro 0.649s (+5.4% 🔺) 1.005s (~) 0.004s (+8.0% 🔺) 1.024s (~) 0.375s 59 1.05x
💻 Local Nitro 0.737s (-3.7%) 1.012s (~) 0.009s (-11.1% 🟢) 1.022s (~) 0.286s 59 1.19x
💻 Local Express 0.816s (+1.3%) 1.011s (~) 0.010s (-1.3%) 1.115s (~) 0.299s 54 1.32x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 4.359s (+0.7%) 6.160s (+2.9%) 1.659s (+473.7% 🔺) 8.317s (+24.0% 🔺) 3.958s 8 1.00x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express

10 parallel streams (1MB each)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.911s (-3.8%) 1.085s (-11.1% 🟢) 0.000s (-100.0% 🟢) 1.102s (-10.6% 🟢) 0.192s 55 1.00x
🐘 Postgres Nitro 0.968s (+1.9%) 1.219s (+4.8%) 0.000s (-78.8% 🟢) 1.233s (+4.2%) 0.265s 49 1.06x
💻 Local Express 1.227s (-12.6% 🟢) 2.020s (~) 0.000s (+5.0% 🔺) 2.022s (-8.1% 🟢) 0.795s 30 1.35x
💻 Local Nitro 1.240s (-5.1% 🟢) 2.021s (~) 0.000s (-14.3% 🟢) 2.023s (~) 0.783s 30 1.36x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.651s (+4.6%) 4.275s (+10.2% 🔺) 0.001s (+438.5% 🔺) 4.724s (+5.1% 🔺) 2.074s 13 1.00x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express

fan-out fan-in 10 streams (1MB each)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 1.747s (~) 2.066s (~) 0.000s (-100.0% 🟢) 2.080s (-1.4%) 0.332s 29 1.00x
🐘 Postgres Express 1.796s (+3.0%) 2.100s (~) 0.000s (-100.0% 🟢) 2.122s (~) 0.326s 29 1.03x
💻 Local Express 3.511s (+2.4%) 4.034s (+1.6%) 0.001s (+6.7% 🔺) 4.036s (+1.6%) 0.525s 15 2.01x
💻 Local Nitro 3.642s (-2.3%) 4.100s (~) 0.001s (+128.6% 🔺) 4.103s (~) 0.461s 15 2.08x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.740s (-10.4% 🟢) 5.364s (-3.9%) 0.000s (+Infinity% 🔺) 5.794s (-4.3%) 2.055s 11 1.00x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Nitro 11/21
🐘 Postgres Express 17/21
▲ Vercel Express 21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 🐘 Postgres 17/21
Nitro 🐘 Postgres 19/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Apr 8, 2026 6:52pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Apr 8, 2026 6:52pm
example-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-astro-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-express-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-fastify-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-hono-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-nitro-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-nuxt-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workbench-vite-workflow Ready Ready Preview, Comment Apr 8, 2026 6:52pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Apr 8, 2026 6:52pm
workflow-swc-playground Ready Ready Preview, Comment Apr 8, 2026 6:52pm

Fully-bundled ESM output needs a real `require` function for CJS
dependencies that call require() on Node.js builtins (e.g. debug
requiring tty). Add a createRequire banner to the steps, workflow,
and webhook bundles.

Also update the CLI standalone config to output .mjs files, and
update world-testing to import from the new .mjs paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The webhook handler (resumeWebhook) needs to read hook metadata to
determine the respondWith behavior. However, the webhook Lambda may
not have the deployment encryption key available, causing metadata
hydration to fail with "Encrypted stream data encountered but no
encryption key is available".

Fix by passing undefined instead of the encryption key when
serializing hook metadata in the suspension handler. Hook metadata
is small (just respondWith config) and doesn't need encryption.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
VaguelySerious and others added 8 commits April 8, 2026 09:25
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The package version was reset from 4.2.x-beta to 4.0.0 for the v5
beta release. The encryption format capability check used 4.2.0-beta.64
as the minimum version, causing getRunCapabilities("4.0.0") to report
encryption as unsupported. This made resumeHook strip the encryption
key, while the step handler still encrypted data — causing "Encrypted
stream data encountered but no encryption key is available" errors in
the webhook handler.

Fix by lowering the minVersion to 4.0.0 to cover the reset range.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reverts debug-only changes that modified the webhook error response
format and added console.error/console.warn logging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…anges

The PR branches had version 4.0.0 (intermediate changeset reset) instead
of 5.0.0-beta.0 (the actual published version). This caused
getRunCapabilities("4.0.0") to report encryption as unsupported, breaking
the webhook respondWith flow on Vercel Prod deployments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@TooTallNate TooTallNate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-motivated change. Fixes the root cause of #1507 (import.meta.url undefined in CJS bundles) rather than polyfilling it. The approach is correct: switch the outer bundles to ESM while keeping the intermediate VM bundle as CJS.

What I verified

Intermediate workflow bundle stays CJS: base-builder.ts:726 is hardcoded format: 'cjs' with comment "Runs inside the VM which expects cjs" — untouched by this PR. Correct.

createRequire banner: The ESM require shim (import { createRequire as __createRequire } from "node:module"; var require = __createRequire(import.meta.url);) is the standard pattern for CJS interop in ESM. This is needed because esbuild's CJS-to-ESM shimming generates require() calls for CJS dependencies (e.g. debugrequire('tty')), and ESM doesn't provide require natively. The banner runs once at module load — negligible overhead.

All three bundle types switched:

  • Steps: format = 'esm' default (was 'cjs'), index.mjs, "type": "module"
  • Final workflow wrapper: format = 'esm' default (was 'cjs'), index.mjs, "type": "module"
  • Webhook: hardcoded 'esm' (was 'cjs'), index.mjs, "type": "module"

Handler config updated: .vc-config.json now uses handler: 'index.mjs' (was 'index.js'). Correct.

CJS polyfill removed: Webhook no longer calls getCjsImportMetaPolyfill() or sets define: webhookImportMetaDefine. Steps/workflows still call it but it's a no-op for format === 'esm' (returns empty string/empty object). Clean.

world-testing updated: server.mts switches from CJS default imports (import flow from '...flow.js'; flow.POST(...)) to ESM named imports (import { POST as flowPOST } from '...flow.mjs'). Build script copies *.mjs instead of *.js. .d.mts stubs generated. All consistent.

CLI paths updated: workflow-config.ts changes .js.mjs for step/flow/webhook bundle paths.

Tests updated: local-build.test.ts now asserts ESM output (no CJS polyfill __import_meta_url, no pathToFileURL(__filename)). Good negative assertions.

Changeset: patch for @workflow/builders and @workflow/cli. Correct.

LGTM.

*/
private getEsmRequireBanner(format: string): string {
if (format !== 'esm') return '';
return 'import { createRequire as __createRequire } from "node:module";\nvar require = __createRequire(import.meta.url);\n';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: The var require = __createRequire(import.meta.url) declaration shadows any ambient require in the scope. In ESM, require isn't defined anyway so there's nothing to shadow. But if esbuild's CJS shim emits its own var require = ... later in the bundle, there could be a double declaration. In practice esbuild doesn't do this for format: 'esm' (it uses __require internally), so it's fine. Just noting for awareness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

import.meta.url not available in step runtime on Vercel

3 participants