feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

feat: support nextjs pages router - #650

Closed
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router
Closed

feat: support nextjs pages router#650
adriandlam wants to merge 14 commits into
mainfrom
feat/support-next-pages-router

Conversation

@adriandlam

@adriandlamadriandlam commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

add nextjs pages router support

fixes#143

@changeset-bot

changeset-botBot commented Dec 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bdf71

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

This PR includes changesets to release 4 packages
NameType
@workflow/nextPatch
workflowPatch
@workflow/aiPatch
@workflow/world-testingPatch

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

@vercel

vercelBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.040s (+1.5%)1.014s (~)0.974s101.00x
🌐 RedisNext.js (Turbopack)0.041s (-1.0%)1.017s (~)0.976s101.02x
💻 LocalNitro0.044s (+2.1%)1.007s (~)0.963s101.10x
💻 LocalExpress0.045s (+3.9%)1.008s (~)0.963s101.13x
💻 LocalNext.js (Turbopack)0.053s (+47.8% 🔺)1.025s (+0.8%)0.972s101.33x
🌐 MongoDBNext.js (Turbopack)0.079s (+8.9% 🔺)1.016s (~)0.938s101.97x
🌐 TursoNext.js (Turbopack)0.108s (+8.0% 🔺)1.013s (~)0.905s102.71x
🐘 PostgresNext.js (Turbopack)0.191s (+27.3% 🔺)1.021s (~)0.830s104.79x
🐘 PostgresNitro0.293s (-13.3% 🟢)1.013s (~)0.720s107.34x
🐘 PostgresExpress0.296s (-23.6% 🟢)1.014s (~)0.718s107.43x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.509s (+9.2% 🔺)1.593s (+13.1% 🔺)1.084s101.00x
▲ VercelExpress0.633s (+20.3% 🔺)1.660s (+19.2% 🔺)1.027s101.24x
▲ VercelNext.js (Turbopack)0.779s (+41.8% 🔺)1.656s (+7.7% 🔺)0.877s101.53x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.088s (-0.6%)2.009s (~)0.920s101.00x
💻 LocalNext.js (Turbopack)1.097s (+1.4%)2.011s (~)0.914s101.01x
🌐 RedisNext.js (Turbopack)1.100s (~)2.013s (~)0.912s101.01x
💻 LocalNitro1.109s (~)2.005s (~)0.896s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.014s (~)0.713s101.20x
🌐 TursoNext.js (Turbopack)1.304s (~)2.011s (~)0.708s101.20x
🐘 PostgresNext.js (Turbopack)2.089s (-13.5% 🟢)2.416s (-19.8% 🟢)0.327s101.92x
🐘 PostgresExpress2.140s (-4.2%)3.016s (~)0.876s101.97x
🐘 PostgresNitro2.149s (-2.0%)3.014s (~)0.865s101.97x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (+5.8% 🔺)3.734s (+4.5%)0.987s101.00x
▲ VercelExpress2.774s (+6.0% 🔺)3.638s (+3.1%)0.864s101.01x
▲ VercelNext.js (Turbopack)2.802s (+8.2% 🔺)3.648s (~)0.846s101.02x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.580s (~)11.010s (~)0.430s51.00x
💻 LocalNext.js (Turbopack)10.622s (+0.7%)11.014s (~)0.392s51.00x
🌐 RedisNext.js (Turbopack)10.698s (~)11.020s (~)0.322s51.01x
💻 LocalNitro10.783s (~)11.011s (~)0.228s51.02x
💻 LocalExpress10.794s (~)11.012s (~)0.219s51.02x
🌐 MongoDBNext.js (Turbopack)12.057s (-1.3%)12.831s (-1.5%)0.774s51.14x
🌐 TursoNext.js (Turbopack)12.185s (~)13.021s (~)0.836s51.15x
🐘 PostgresNext.js (Turbopack)14.874s (-3.5%)15.237s (-5.0%)0.363s51.41x
🐘 PostgresExpress20.373s (~)20.832s (-1.0%)0.459s51.93x
🐘 PostgresNitro20.408s (+29.4% 🔺)21.035s (+26.5% 🔺)0.626s51.93x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.165s (+5.2% 🔺)22.889s (+5.8% 🔺)0.724s51.00x
▲ VercelNext.js (Turbopack)22.437s (+6.3% 🔺)23.019s (+5.3% 🔺)0.582s51.01x
▲ VercelNitro22.662s (+10.1% 🔺)23.603s (+10.9% 🔺)0.941s51.02x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.357s (+1.4%)2.008s (~)0.650s151.00x
🌐 RedisNext.js (Turbopack)1.361s (+0.6%)2.010s (~)0.649s151.00x
💻 LocalNext.js (Turbopack)1.376s (+1.8%)2.010s (~)0.634s151.01x
💻 LocalNitro1.404s (-1.2%)2.005s (~)0.602s151.03x
💻 LocalExpress1.415s (+1.3%)2.006s (~)0.590s151.04x
🐘 PostgresNext.js (Turbopack)1.748s (-17.7% 🟢)2.012s (-13.4% 🟢)0.264s151.29x
🌐 MongoDBNext.js (Turbopack)2.132s (-1.6%)3.015s (~)0.883s101.57x
🌐 TursoNext.js (Turbopack)2.218s (~)3.010s (~)0.792s101.63x
🐘 PostgresExpress2.348s (-3.2%)3.013s (~)0.665s101.73x
🐘 PostgresNitro2.399s (+12.5% 🔺)3.012s (+21.8% 🔺)0.613s101.77x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.973s (+4.5%)3.919s (+6.8% 🔺)0.946s81.00x
▲ VercelExpress3.022s (+10.2% 🔺)4.022s (+12.9% 🔺)1.000s81.02x
▲ VercelNext.js (Turbopack)3.364s (+14.3% 🔺)3.987s (+2.2%)0.623s81.13x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express2.174s (-1.9%)3.057s (-3.3%)0.883s101.00x
💻 LocalNitro2.190s (-0.7%)3.165s (~)0.975s101.01x
💻 LocalNext.js (Turbopack)2.212s (+9.8% 🔺)3.110s (+22.0% 🔺)0.899s101.02x
🌐 StarterNext.js (Turbopack)2.483s (+1.3%)3.008s (~)0.526s101.14x
🌐 RedisNext.js (Turbopack)2.497s (+0.6%)3.019s (~)0.523s101.15x
🐘 PostgresNext.js (Turbopack)2.577s (-6.1% 🟢)3.015s (~)0.439s101.19x
🐘 PostgresNitro2.755s (-3.1%)3.022s (~)0.267s101.27x
🐘 PostgresExpress3.021s (+2.6%)3.485s (+3.3%)0.464s91.39x
🌐 MongoDBNext.js (Turbopack)4.713s (+2.3%)5.182s (~)0.469s62.17x
🌐 TursoNext.js (Turbopack)4.715s (+1.0%)5.180s (~)0.465s62.17x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.116s (+17.7% 🔺)4.869s (+15.0% 🔺)0.753s71.00x
▲ VercelNext.js (Turbopack)4.300s (+23.4% 🔺)5.218s (+28.2% 🔺)0.918s61.04x
▲ VercelNitro4.744s (+50.9% 🔺)5.496s (+48.6% 🔺)0.753s61.15x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.380s (+3.1%)2.008s (~)0.628s151.00x
🌐 RedisNext.js (Turbopack)1.386s (+1.7%)2.009s (~)0.623s151.00x
💻 LocalNext.js (Turbopack)1.402s (+2.8%)2.012s (~)0.610s151.02x
💻 LocalExpress1.413s (-0.6%)2.006s (~)0.593s151.02x
💻 LocalNitro1.424s (~)2.005s (~)0.582s151.03x
🐘 PostgresNext.js (Turbopack)1.712s (~)2.012s (~)0.300s151.24x
🐘 PostgresExpress1.809s (-7.9% 🟢)2.010s (-3.2%)0.201s151.31x
🐘 PostgresNitro1.900s (+13.1% 🔺)2.011s (~)0.111s151.38x
🌐 MongoDBNext.js (Turbopack)2.124s (~)3.016s (~)0.892s101.54x
🌐 TursoNext.js (Turbopack)2.219s (-0.7%)3.010s (~)0.791s101.61x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.769s (-0.7%)3.766s (-0.9%)0.997s81.00x
▲ VercelNitro2.777s (+6.2% 🔺)3.711s (+6.1% 🔺)0.934s91.00x
▲ VercelExpress3.231s (+28.3% 🔺)4.084s (+15.7% 🔺)0.853s81.17x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro2.227s (-4.6%)3.173s (-2.1%)0.946s101.00x
💻 LocalNext.js (Turbopack)2.277s (+8.8% 🔺)3.206s (+7.5% 🔺)0.929s101.02x
💻 LocalExpress2.348s (+2.0%)3.227s (~)0.879s101.05x
🌐 StarterNext.js (Turbopack)2.475s (+0.8%)3.011s (~)0.536s101.11x
🌐 RedisNext.js (Turbopack)2.518s (+1.1%)3.012s (~)0.494s101.13x
🐘 PostgresNext.js (Turbopack)2.639s (+7.2% 🔺)3.021s (~)0.382s101.19x
🐘 PostgresExpress2.686s (-7.4% 🟢)3.019s (~)0.333s101.21x
🐘 PostgresNitro2.702s (-1.2%)3.013s (~)0.311s101.21x
🌐 TursoNext.js (Turbopack)4.654s (-2.1%)5.180s (~)0.526s62.09x
🌐 MongoDBNext.js (Turbopack)4.661s (+0.6%)5.189s (~)0.528s62.09x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.330s (+10.0% 🔺)4.108s (+12.4% 🔺)0.779s81.00x
▲ VercelExpress3.442s (+14.0% 🔺)3.965s (+9.3% 🔺)0.523s81.03x
▲ VercelNext.js (Turbopack)3.449s (+14.1% 🔺)4.130s (+11.6% 🔺)0.681s81.04x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-2.1%)1.006s (~)0.000s (NaN%)1.011s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.135s (+23.0% 🔺)1.003s (~)0.019s (+16.3% 🔺)1.029s (~)0.894s101.08x
🌐 RedisNext.js (Turbopack)0.143s (~)1.005s (~)0.000s (NaN%)1.013s (~)0.870s101.15x
💻 LocalNitro0.173s (-4.5%)0.993s (~)0.018s (+13.6% 🔺)1.025s (~)0.852s101.38x
💻 LocalExpress0.176s (+1.3%)0.992s (~)0.015s (-13.1% 🟢)1.021s (~)0.845s101.41x
🌐 MongoDBNext.js (Turbopack)0.485s (-2.2%)0.963s (+1.2%)0.000s (NaN%)1.015s (~)0.530s103.88x
🌐 TursoNext.js (Turbopack)0.498s (~)0.948s (~)0.000s (NaN%)1.012s (~)0.514s103.99x
🐘 PostgresNext.js (Turbopack)0.826s (-27.8% 🟢)1.312s (-31.1% 🟢)0.000s (NaN%)1.417s (-29.8% 🟢)0.592s106.61x
🐘 PostgresExpress1.277s (-45.7% 🟢)1.763s (-34.5% 🟢)0.000s (-100.0% 🟢)2.013s (-33.3% 🟢)0.736s1010.22x
🐘 PostgresNitro2.313s (+59.6% 🔺)2.733s (+64.0% 🔺)0.000s (+Infinity% 🔺)3.014s (+49.8% 🔺)0.701s1018.52x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.884s (+11.4% 🔺)3.340s (+8.5% 🔺)0.595s (+40.2% 🔺)4.442s (+13.8% 🔺)1.558s101.00x
▲ VercelNext.js (Turbopack)3.082s (+15.9% 🔺)3.476s (+7.0% 🔺)0.430s (+83.6% 🔺)4.407s (+12.5% 🔺)1.326s101.07x
▲ VercelExpress3.090s (+24.5% 🔺)3.499s (+15.6% 🔺)0.445s (+59.4% 🔺)4.452s (+19.8% 🔺)1.362s101.07x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)5/8
🐘 PostgresNext.js (Turbopack)8/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter6/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production2892312324
✅ 💻 Local Development28908297
✅ 📦 Local Production28908297
✅ 🐘 Local Postgres28908297
✅ 🪟 Windows270027
❌ 🌍 Community Worlds109110120
Total129234361362

❌ Failed Tests

▲ Vercel Production (23 failed)

nextjs-pages (23 failed):

  • addTenWorkflow
  • addTenWorkflow
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
❌ nextjs-pages3231
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-pages-router-stable2700
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack2700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@socket-security

socket-securityBot commented Dec 18, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

DiffPackageSupply Chain
Security
VulnerabilityQualityMaintenanceLicense
Addednpm/​react@​19.2.11001008497100
Addednpm/​react-dom@​19.2.11001009298100

View full report

@adriandlam
adriandlamforce-pushed the feat/support-next-pages-router branch from a524531 to d03acf3CompareDecember 18, 2025 22:39
return;
}

const { token, data } = JSON.parse(req.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook.ts endpoint unconditionally calls JSON.parse(req.body), but with Next.js's default body parser enabled, req.body is already an object and cannot be parsed as JSON. This will throw a runtime error.

View Details
📝 Patch Details
diff --git a/workbench/nextjs-pages-router/pages/api/hook.ts b/workbench/nextjs-pages-router/pages/api/hook.ts
index 4092d6f..ef9e1be 100644
--- a/workbench/nextjs-pages-router/pages/api/hook.ts+++ b/workbench/nextjs-pages-router/pages/api/hook.ts@@ -10,7 +10,7 @@ export default async function handler(
return;
}
- const { token, data } = JSON.parse(req.body);+ const { token, data } = req.body as { token: string; data: unknown };
let hook: Awaited<ReturnType<typeof getHookByToken>>;
try {
diff --git a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts
index ce36778..2d487c4 100644
--- a/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts+++ b/workbench/nextjs-pages-router/pages/api/test-direct-step-call.ts@@ -14,7 +14,7 @@ export default async function handler(
return;
}
- const { x, y } = JSON.parse(req.body);+ const { x, y } = req.body as { x: number; y: number };
console.log(`Calling step function directly with x=${x}, y=${y}`);

Analysis

Next.js API routes unconditionally calling JSON.parse on already-parsed request bodies

What fails:pages/api/hook.ts and pages/api/test-direct-step-call.ts fail when receiving POST requests with JSON content, because they call JSON.parse(req.body) when req.body is already a parsed object.

How to reproduce:

'

Result: Runtime error: TypeError: "[object Object]" is not valid JSON

Expected behavior: The request should be processed successfully. Per Next.js API Routes documentation, the default configuration automatically parses the request body into an object based on content-type. req.body is already a parsed object and does not need JSON.parse().

Root cause: The code assumed req.body was a JSON string, but Next.js automatically parses it into an object by default. Other routes in the same project (workflows/await.ts, workflows/start.ts, workflows/stream.ts) correctly treat req.body as an object directly.

Fix: Changed both endpoints to destructure req.body directly as an object with appropriate type assertions, matching the pattern used by other API routes in the project.

const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regex pattern used to replace the steps bundle export statement is incomplete and will produce invalid JavaScript syntax. The pattern doesn't account for the from 'workflow/runtime' part of the re-export statement.

View Details
📝 Patch Details
diff --git a/packages/astro/src/builder.ts b/packages/astro/src/builder.ts
index 5237247..09dc400 100644
--- a/packages/astro/src/builder.ts+++ b/packages/astro/src/builder.ts@@ -91,7 +91,7 @@ export class LocalBuilder extends BaseBuilder {
// Normalize request, needed for preserving request through astro
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);
diff --git a/packages/next/src/builder.ts b/packages/next/src/builder.ts
index 85b7a90..174509e 100644
--- a/packages/next/src/builder.ts+++ b/packages/next/src/builder.ts@@ -760,7 +760,7 @@ async function sendPagesResponse(res, webResponse) {
const pagesRouterWrapper = `// biome-ignore-all lint: generated file
/* eslint-disable */
${PAGES_ADAPTER_CODE}
-${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g, 'const POST = stepEntrypoint;')}+${stepsBundle.replace(/export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g, 'const POST = stepEntrypoint;')}
export default async function handler(req, res) {
const webRequest = await convertPagesRequest(req);
diff --git a/packages/sveltekit/src/builder.ts b/packages/sveltekit/src/builder.ts
index 531c754..681e600 100644
--- a/packages/sveltekit/src/builder.ts+++ b/packages/sveltekit/src/builder.ts@@ -90,7 +90,7 @@ export class SvelteKitBuilder extends BaseBuilder {
// Replace the default export with SvelteKit-compatible handler
stepsRouteContent = stepsRouteContent.replace(
- /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m,+ /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m,
`${NORMALIZE_REQUEST_CODE}
export const POST = async ({request}) => {
const normalRequest = await normalizeRequest(request);

Analysis

Incomplete regex pattern for re-export statement replacement causes invalid JavaScript syntax

What fails: The regex patterns used in pages/astro/sveltekit builders to replace export { stepEntrypoint as POST } statements do not match statements containing the from 'module' clause, resulting in malformed code like const POST = stepEntrypoint; from 'workflow/runtime';

How to reproduce:

  1. Build a Next.js/Astro/SvelteKit project with a workflow step
  2. The base builder's createStepsBundle() method generates an entry with: export { stepEntrypoint as POST } from 'workflow/runtime';
  3. When this gets bundled and the Pages Router/Astro/SvelteKit handlers attempt to replace the export statement using the incomplete regex pattern, the from 'workflow/runtime' clause is left behind
  4. Result: Invalid JavaScript syntax that will fail to parse

Example failure:

Input:

export{stepEntrypointasPOST}from'workflow/runtime';

Old regex /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g produces:

constPOST=stepEntrypoint;from'workflow/runtime';

This is invalid JavaScript and will cause a syntax error.

Root cause: The regex patterns in three files do not account for the optional from 'module' clause that esbuild preserves in re-export statements:

  • packages/next/src/builder.ts line 763
  • packages/astro/src/builder.ts line 94
  • packages/sveltekit/src/builder.ts line 93

Solution: Updated regex patterns to optionally match and remove the from 'module' clause:

  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\};?/g (Next.js)
  • Changed: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}\s*;?$/m (Astro/SvelteKit)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?/g (Next.js)
  • To: /export\s*\{\s*stepEntrypoint\s+as\s+POST\s*\}(?:\s+from\s+['"][^'"]*['"])?\s*;?$/m (Astro/SvelteKit)

The new pattern uses a non-capturing group (?:...) with an optional modifier ? to match the from 'module' clause, handling both single and double quotes.

@adriandlam

Copy link
Copy Markdown
ContributorAuthor

update: we just need this PR merged: vercel/vercel which adds support for the experimentalTriggers config, then E2E Vercel Prod Tests should pass

Sign up for freeto 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.

Workflows not bundled on page router

1 participant

@adriandlam