Skip to content

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

@TooTallNate@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
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;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Add support for serializing `this` when invoking step functions by TooTallNate · Pull Request #754 · vercel/workflow · GitHub
Skip to content

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

@TooTallNate@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add support for serializing `this` when invoking step functions by TooTallNate · Pull Request #754 · vercel/workflow · GitHub
Skip to content

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

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

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

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

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

@TooTallNate@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add support for serializing `this` when invoking step functions by TooTallNate · Pull Request #754 · vercel/workflow · GitHub
Skip to content

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

@TooTallNate@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add support for serializing `this` when invoking step functions by TooTallNate · Pull Request #754 · vercel/workflow · GitHub
Skip to content

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

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

Add support for serializing this when invoking step functions - #754

Merged
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions
Jan 14, 2026
Merged

Add support for serializing this when invoking step functions#754
TooTallNate merged 9 commits into
mainfrom
01-08-add_support_for_serializing_this_when_invoking_step_functions

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
Member

Added support for serializing this context when invoking step functions.

What changed?

  • Modified the step function implementation to capture and serialize the this context when it's defined and not the global object
  • Updated the step invocation queue item interface to include an optional thisVal property
  • Enhanced the step handler to apply the hydrated thisVal when executing step functions

Why make this change?

This enhancement allows step functions to be invoked with an explicit context object using standard JavaScript methods like .call() and .apply(). This is particularly useful for step functions that need to access properties from a specific context, enabling more flexible and idiomatic JavaScript patterns within workflows.

@changeset-bot

changeset-botBot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15c9b77

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

This PR includes changesets to release 15 packages
NameType
@workflow/nitroPatch
@workflow/swc-pluginPatch
workflowPatch
@workflow/corePatch
@workflow/nuxtPatch
@workflow/astroPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/aiPatch
@workflow/docs-typecheckPatch
@workflow/world-testingPatch
@workflow/web-sharedPatch

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 Jan 9, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production418011429
✅ 💻 Local Development38208390
✅ 📦 Local Production38208390
✅ 🐘 Local Postgres38208390
✅ 🪟 Windows390039
❌ 🌍 Community Worlds147210168
Total175021351806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • 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
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro3801
✅ example3801
✅ express3801
✅ fastify3801
✅ hono3801
✅ nextjs-turbopack3801
✅ nextjs-webpack3801
✅ nitro3801
✅ nuxt3801
✅ sveltekit3801
✅ vite3801
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable3801
✅ express-stable3801
✅ fastify-stable3801
✅ hono-stable3801
✅ nextjs-turbopack-stable3900
✅ nextjs-webpack-stable3900
✅ nitro-stable3801
✅ nuxt-stable3801
✅ sveltekit-stable3801
✅ vite-stable3801
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack3900
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb3810
✅ redis-dev300
❌ redis3810
✅ starter-dev300
❌ starter21180
✅ turso-dev300
❌ turso3810

📋 View full workflow run

@TooTallNateGraphite App

TooTallNate commented Jan 9, 2026

Copy link
Copy Markdown
MemberAuthor

CopilotAI left a comment

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.

Pull request overview

This PR adds support for serializing the this context when invoking step functions, enabling the use of JavaScript's .call() and .apply() methods with step functions.

  • Modified step function creation to use a regular function instead of an arrow function to capture this context
  • Added optional thisVal property to the step invocation queue item interface
  • Enhanced serialization/deserialization flow to handle thisVal alongside existing args and closureVars

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/core/src/step.tsChanged to regular function to capture this and conditionally serialize it when not undefined/null/globalThis
packages/core/src/global.tsAdded optional thisVal property to StepInvocationQueueItem interface
packages/core/src/runtime/suspension-handler.tsIncluded thisVal in the dehydrated step input
packages/core/src/runtime/step-handler.tsHydrated and applied thisVal when executing step functions, updated comment
workbench/example/workflows/99_e2e.tsAdded example workflow demonstrating .call() and .apply() usage with step functions
packages/core/e2e/e2e.test.tsAdded e2e test validating thisSerializationWorkflow behavior
.changeset/old-pugs-win.mdAdded changeset documenting the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/core/src/step.ts
Comment threadpackages/core/e2e/e2e.test.ts
vercel[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jan 14, 2026

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
💻 Local🥇 Nitro0.032s (-27.3% 🟢)1.007s (~)0.975s101.00x
💻 LocalNext.js (Turbopack)0.032s (-18.8% 🟢)1.015s (~)0.982s101.01x
🌐 RedisNext.js (Turbopack)0.041s (+3.0%)1.016s (~)0.975s101.28x
🌐 StarterNext.js (Turbopack)0.042s (+11.9% 🔺)1.014s (~)0.973s101.29x
💻 LocalExpress0.044s (-2.2%)1.008s (~)0.964s101.36x
🌐 TursoNext.js (Turbopack)0.102s (+2.9%)1.014s (~)0.912s103.16x
🌐 MongoDBNext.js (Turbopack)0.106s (+3.9%)1.014s (~)0.908s103.29x
🐘 PostgresNext.js (Turbopack)0.192s (-23.8% 🟢)1.024s (~)0.832s105.96x
🐘 PostgresNitro0.297s (+4.5%)1.012s (~)0.715s109.23x
🐘 PostgresExpress0.332s (~)1.016s (~)0.683s1010.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.577s (-14.9% 🟢)1.496s (-13.6% 🟢)0.918s101.00x
▲ VercelNitro0.600s (+1.6%)1.658s (+15.5% 🔺)1.058s101.04x
▲ VercelExpress0.613s (+8.3% 🔺)1.553s (~)0.940s101.06x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.073s (-3.4%)2.006s (~)0.932s101.00x
💻 LocalNext.js (Turbopack)1.078s (-2.2%)2.012s (~)0.933s101.00x
🌐 StarterNext.js (Turbopack)1.094s (~)2.009s (~)0.915s101.02x
🌐 RedisNext.js (Turbopack)1.098s (~)2.011s (~)0.913s101.02x
💻 LocalExpress1.114s (~)2.007s (~)0.894s101.04x
🌐 TursoNext.js (Turbopack)1.309s (+1.5%)2.012s (~)0.703s101.22x
🌐 MongoDBNext.js (Turbopack)1.310s (-0.5%)2.012s (~)0.702s101.22x
🐘 PostgresNext.js (Turbopack)1.879s (~)2.017s (~)0.137s101.75x
🐘 PostgresNitro2.159s (+1.6%)3.015s (~)0.856s102.01x
🐘 PostgresExpress2.168s (-1.5%)3.015s (~)0.847s102.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.681s (-3.8%)3.707s (+3.9%)1.027s101.00x
▲ VercelNext.js (Turbopack)2.729s (-8.6% 🟢)3.593s (-5.6% 🟢)0.864s101.02x
▲ VercelExpress2.946s (-6.7% 🟢)3.868s (-5.5% 🟢)0.922s101.10x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.515s (-2.5%)11.009s (~)0.494s51.00x
💻 LocalNext.js (Turbopack)10.532s (-1.4%)11.016s (~)0.484s51.00x
🌐 StarterNext.js (Turbopack)10.596s (~)11.013s (~)0.417s51.01x
🌐 RedisNext.js (Turbopack)10.641s (~)11.015s (~)0.374s51.01x
💻 LocalExpress10.800s (~)11.016s (~)0.217s51.03x
🌐 TursoNext.js (Turbopack)12.202s (~)13.022s (~)0.820s51.16x
🌐 MongoDBNext.js (Turbopack)12.277s (~)13.028s (~)0.751s51.17x
🐘 PostgresNext.js (Turbopack)15.174s (~)16.038s (~)0.865s51.44x
🐘 PostgresExpress19.766s (-2.1%)20.037s (-4.7%)0.271s51.88x
🐘 PostgresNitro20.452s (~)21.029s (~)0.577s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)28.705s (+30.3% 🔺)29.494s (+29.8% 🔺)0.789s51.00x
▲ VercelNitro29.607s (+29.2% 🔺)30.570s (+29.5% 🔺)0.963s51.03x
▲ VercelExpress29.888s (+37.2% 🔺)30.695s (+35.6% 🔺)0.807s51.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.328s (-5.5% 🟢)2.005s (~)0.677s151.00x
💻 LocalNext.js (Turbopack)1.343s (-4.0%)2.013s (~)0.670s151.01x
🌐 StarterNext.js (Turbopack)1.347s (~)2.008s (~)0.661s151.01x
🌐 RedisNext.js (Turbopack)1.351s (~)2.010s (~)0.658s151.02x
💻 LocalExpress1.414s (~)2.006s (~)0.592s151.06x
🐘 PostgresNext.js (Turbopack)1.745s (-4.3%)2.013s (~)0.268s151.31x
🌐 MongoDBNext.js (Turbopack)2.129s (-0.6%)3.013s (~)0.884s101.60x
🌐 TursoNext.js (Turbopack)2.231s (+0.7%)3.015s (~)0.784s101.68x
🐘 PostgresExpress2.342s (-6.4% 🟢)3.013s (~)0.671s101.76x
🐘 PostgresNitro2.512s (+4.0%)3.012s (~)0.500s101.89x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.848s (-3.5%)3.730s (-1.5%)0.881s91.00x
▲ VercelNext.js (Turbopack)2.891s (-8.0% 🟢)3.789s (-5.6% 🟢)0.899s81.01x
▲ VercelExpress2.987s (-1.9%)3.941s (+1.0%)0.954s81.05x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.990s (-8.6% 🟢)2.159s (-31.2% 🟢)0.169s151.00x
💻 LocalNext.js (Turbopack)2.011s (-5.1% 🟢)2.539s (-15.1% 🟢)0.528s121.01x
💻 LocalExpress2.196s (-1.0%)3.083s (-2.8%)0.887s101.10x
🌐 StarterNext.js (Turbopack)2.461s (~)3.008s (~)0.547s101.24x
🌐 RedisNext.js (Turbopack)2.497s (~)3.027s (+0.5%)0.530s101.25x
🐘 PostgresNext.js (Turbopack)2.557s (-1.0%)3.017s (~)0.460s101.29x
🐘 PostgresNitro2.950s (-8.4% 🟢)3.113s (-17.7% 🟢)0.163s101.48x
🐘 PostgresExpress3.326s (+16.7% 🔺)4.040s (+34.2% 🔺)0.713s81.67x
🌐 TursoNext.js (Turbopack)4.696s (~)5.182s (~)0.486s62.36x
🌐 MongoDBNext.js (Turbopack)4.721s (-1.9%)5.179s (-3.4%)0.457s62.37x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.453s (-26.0% 🟢)4.061s (-22.2% 🟢)0.607s81.00x
▲ VercelNext.js (Turbopack)3.793s (-42.3% 🟢)4.647s (-37.2% 🟢)0.854s71.10x
▲ VercelExpress4.699s (-45.6% 🟢)5.516s (-42.3% 🟢)0.817s61.36x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.339s (-4.6%)2.011s (~)0.672s151.00x
🌐 StarterNext.js (Turbopack)1.354s (~)2.007s (~)0.653s151.01x
💻 LocalNitro1.356s (-3.8%)2.005s (~)0.650s151.01x
🌐 RedisNext.js (Turbopack)1.372s (-0.5%)2.010s (~)0.639s151.02x
💻 LocalExpress1.415s (-1.3%)2.006s (~)0.591s151.06x
🐘 PostgresNext.js (Turbopack)1.594s (-11.6% 🟢)2.012s (~)0.419s151.19x
🐘 PostgresNitro1.948s (+6.0% 🔺)2.517s (+16.7% 🔺)0.568s121.45x
🐘 PostgresExpress1.975s (+5.1% 🔺)2.320s (+4.1%)0.346s131.47x
🌐 MongoDBNext.js (Turbopack)2.163s (+0.6%)3.011s (~)0.849s101.61x
🌐 TursoNext.js (Turbopack)2.239s (+0.9%)3.015s (~)0.776s101.67x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.744s (-65.6% 🟢)3.814s (-56.2% 🟢)1.070s81.00x
▲ VercelNext.js (Turbopack)3.016s (-58.1% 🟢)3.837s (-50.2% 🟢)0.822s81.10x
▲ VercelExpress3.087s (-43.7% 🟢)3.914s (-38.3% 🟢)0.827s81.12x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.996s (-9.4% 🟢)2.168s (-31.7% 🟢)0.171s141.00x
💻 LocalNext.js (Turbopack)2.031s (-10.8% 🟢)2.703s (-13.1% 🟢)0.672s121.02x
💻 LocalExpress2.323s (-2.2%)3.219s (-2.5%)0.896s101.16x
🌐 StarterNext.js (Turbopack)2.467s (-0.7%)3.020s (~)0.553s101.24x
🌐 RedisNext.js (Turbopack)2.517s (+1.2%)3.013s (~)0.496s101.26x
🐘 PostgresNext.js (Turbopack)2.607s (-0.7%)3.020s (~)0.414s101.31x
🐘 PostgresExpress2.763s (-3.5%)3.021s (~)0.258s101.38x
🐘 PostgresNitro2.821s (+1.2%)3.014s (-3.6%)0.194s101.41x
🌐 MongoDBNext.js (Turbopack)4.654s (-2.3%)5.179s (~)0.525s62.33x
🌐 TursoNext.js (Turbopack)4.655s (~)5.179s (~)0.524s62.33x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.241s (-1.8%)3.857s (~)0.616s81.00x
▲ VercelExpress3.252s (+5.3% 🔺)3.873s (+5.6% 🔺)0.621s81.00x
▲ VercelNext.js (Turbopack)3.293s (-2.3%)3.906s (+1.7%)0.614s81.02x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.105s (-29.0% 🟢)1.003s (~)0.014s (-26.4% 🟢)1.025s (-0.6%)0.920s101.00x
💻 LocalNitro0.120s (-31.1% 🟢)0.999s (+0.6%)0.014s (-2.1%)1.020s (~)0.899s101.14x
🌐 StarterNext.js (Turbopack)0.132s (+1.1%)1.006s (~)0.000s (NaN%)1.012s (~)0.880s101.26x
🌐 RedisNext.js (Turbopack)0.139s (-3.6%)1.004s (~)0.000s (NaN%)1.012s (~)0.873s101.33x
💻 LocalExpress0.179s (+1.9%)0.992s (~)0.016s (-6.0% 🟢)1.023s (~)0.844s101.71x
🌐 MongoDBNext.js (Turbopack)0.486s (-5.5% 🟢)0.964s (+1.8%)0.000s (~)1.014s (~)0.528s104.63x
🌐 TursoNext.js (Turbopack)0.487s (+4.5%)0.964s (-1.6%)0.000s (+100.0% 🔺)1.013s (~)0.525s104.65x
🐘 PostgresNext.js (Turbopack)1.247s (-4.4%)1.651s (-5.1% 🟢)0.000s (-100.0% 🟢)1.819s (-9.9% 🟢)0.572s1011.89x
🐘 PostgresExpress1.280s (-47.0% 🟢)1.760s (-33.0% 🟢)0.000s (NaN%)2.013s (-33.2% 🟢)0.733s1012.20x
🐘 PostgresNitro2.414s (+7.8% 🔺)2.627s (-6.3% 🟢)0.000s (NaN%)3.013s (~)0.599s1023.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.193s (+22.9% 🔺)3.462s (+5.9% 🔺)0.435s (+118.4% 🔺)4.517s (+16.0% 🔺)1.324s101.00x
▲ VercelNitro3.216s (+21.7% 🔺)3.446s (+11.3% 🔺)0.421s (+39.0% 🔺)4.431s (+15.3% 🔺)1.215s101.01x
▲ VercelNext.js (Turbopack)3.594s (+34.1% 🔺)3.914s (+20.6% 🔺)0.202s (-38.9% 🟢)4.805s (+20.5% 🔺)1.211s101.13x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro6/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)💻 Local8/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

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.

3 participants

@TooTallNate@pranaygp