-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
- Workflow DevKit:
4.0.1-beta.2 - Next.js: 16
- node: 22
- World:
world-local
Problem
Workflow streaming writes chunks successfully to .next/workflow-data/streams/chunks/ but workflowHandle.getReadable() never yields them. The stream reader blocks forever.
Expected:
const handle = await run(myWorkflow, 'test-stream');
const readable = await handle.getReadable({ startIndex: 0 });
const reader = readable.getReader();
const { value } = await reader.read(); // Should return chunkActual:
reader.read()blocks indefinitely- Chunks exist on disk with correct data
- Workflow completes successfully
- No errors logged
Reproduction:
// workflow
export async function testWorkflow(streamName: string) {
'use workflow';
const writer = await getWritable(streamName);
for (let i = 0; i < 3; i++) {
await writer.write({ chunk: i });
}
await writer.close();
}
// route handler
export async function POST(req: Request) {
const handle = await run(testWorkflow, 'test');
const readable = await handle.getReadable({ startIndex: 0 });
const reader = readable.getReader();
const { value } = await reader.read(); // Blocks forever
return Response.json({ value });
}Hypothesis
The readFromStream() function should:
- Read existing chunk files from disk
- Subscribe to EventEmitter for real-time chunks
Both appear broken - EventEmitter likely doesn’t work across Next.js route boundaries, and file reading logic may also have issues.
Note: This may be the first streaming bug report for world-local. Happy to provide additional debugging info.
Have reviewed all examples but no luck
Metadata
Metadata
Assignees
Labels
No labels