You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In server component on the vercel world, get stuck awaiting workflow's run.returnValue despite the workflow returning #618
In server component on the vercel world, get stuck awaiting workflow's run.returnValue despite the workflow returning
This happens in the vercel world but not in development:
// app/workflows/test-workflow.tsimport{sleep}from"workflow";exportasyncfunctiontestWorkflow(input: string){"use workflow";console.log("[testWorkflow] 1. Started with:",input);awaitsleep("2 seconds");console.log("[testWorkflow] 2. After sleep");return{message: `Hello ${input}`,timestamp: Date.now()};}
// app/page.tsximport{start}from"workflow/api";import{testWorkflow}from"@/app/workflows/test-workflow";exportconstdynamic="force-dynamic";// otherwise can't deploy because the build hangs on await and times outexportdefaultasyncfunctionTestWorkflowPage(){console.log("[TestPage] 1. Starting");construn=awaitstart(testWorkflow,["world"]);console.log("[TestPage] 2. Started, runId:",run.runId);conststatus=awaitrun.status;console.log("[TestPage] 3. Status:",status);console.log("[TestPage] 4. Awaiting returnValue...");constresult=awaitrun.returnValue;// <-- ❌ code will not move past this point, will ultimately timeoutconsole.log("[TestPage] 5. Got result:",result);return(<divclassName="p-8"><h1>TestWorkflowResult</h1><pre>{JSON.stringify(result,null,2)}</pre></div>);}
Logs
✅ work in development
[TestPage] 1. Starting
[TestPage] 2. Started, runId: wrun_01KCJA3HBQNQ5NP7E092NQXSP1
[TestPage] 3. Status: pending
[TestPage] 4. Awaiting returnValue...
[testWorkflow] 1. Started with: world
POST /.well-known/workflow/v1/flow 503 in 66ms (compile: 3ms, render: 63ms)
[testWorkflow] 1. Started with: world
[testWorkflow] 2. After sleep
POST /.well-known/workflow/v1/flow 200 in 30ms (compile: 2ms, render: 28ms)
[TestPage] 5. Got result: { message: 'Hello world', timestamp: 1765846142391 }
GET / 200 in 3.1s (compile: 5ms, render: 3.1s)
❌ Fails in prod on vercel world
2025-12-16 00:50:41.201 [info] [TestPage] 1. Starting
2025-12-16 00:50:41.570 [info] [TestPage] 2. Started, runId: wrun_01KCJA6M2F8F2RSAXWYXZ3W754
2025-12-16 00:50:41.632 [info] [TestPage] 3. Status: pending
2025-12-16 00:50:41.632 [info] [TestPage] 4. Awaiting returnValue...
2025-12-16 00:50:41.903 [info] [testWorkflow] 1. Started with: world
2025-12-16 00:50:46.892 [info] [testWorkflow] 1. Started with: world
2025-12-16 00:50:46.894 [info] [testWorkflow] 2. After sleep
2025-12-16 00:55:40.884 [error] Vercel Runtime Timeout Error: Task timed out after 300 seconds
The workflow is marked as completed in the observability panel:
I patched @workflow/world-vercel/dist/utils.js to log the results of the fetch util, suspecting that the result of the fetch call was being cached during the render of the RSC.
We can see in the logs below that the reply always contain status: 'pending' despite the workflow being finished.
Activity
Fix RSC hang by replacing workflow with direct function call
remiconnesson commentedon Dec 16, 2025
I patched
@workflow/world-vercel/dist/utils.jsto log the results of the fetch util, suspecting that the result of the fetch call was being cached during the render of the RSC.We can see in the logs below that the reply always contain
status: 'pending'despite the workflow being finished.Patch of
@workflow/world-vercel/dist/utils.jsLogs from the workflow
Logs from the RSC
adriandlam commentedon Dec 17, 2025
hey @remiconnesson! thanks for the minimum repro, i believe it should be fixed in #639 but feel free to re-open if it isn't!
[world-vercel] Bust Next.js fetch cache on v4 event reads