preset: bun preset uses incorrect ReadableStream parameters
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
- #4265 de @harshagarwalnyu — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- bun, node.js, react, typescript
- Área
- backend, build-system
Línea de trabajo
Comienza localizando el Nitro bun preset y la integración generada de React DOM Server que crea el ReadableStream con el tipo "direct". Reproduce el fallo con el prerendering de TanStack Start habilitado y, después, verifica que el bun preset produzca parámetros de stream válidos y que la compilación de prerenderización finalice sin ERR_INVALID_ARG_VALUE.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
Bun v1.3.13
Node v24.15.0
Nitro:
Working version: v3.0.1-alpha.2
Broken version: v3.0.260311-beta (and later versions)
Reproduction
Since I am working on a private project, I cannot share the environement, but this should work in any Tanstack Start + Nitro project. You just need to enable prerendering and try to build the project.
tanstackStart({
prerender: {
enabled: true,
crawlLinks: true
},
}),
Describe the bug
This bug is related to the "bun" preset.
It generates this code (in the require_react_dom_server_bun_production function):
var stream = new ReadableStream({
type: "direct",
pull: function(controller) {
if (13 === request.status) request.status = 14, closeWithError(controller, request.fatalError);
else if (14 !== request.status && null === request.destination) {
request.destination = controller;
try {
flushCompletedQueues(request, controller);
} catch (error) {
logRecoverableError(request, error, {}), fatalError(request, error);
}
}
},
cancel: function(reason) {
request.destination = null;
abort(request, reason);
}
}, {
highWaterMark: 2048
});
This code then throws this error:
[unhandledRejection] TypeError [ERR_INVALID_ARG_VALUE]: The property 'source.type' is invalid. Received 'direct'
at new ReadableStream (node:internal/webstreams/readablestream:278:15)
at file:////apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:9049:18
at completeShell (file:///apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8549:3)
at finishedTask (file:///apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8581:38)
at performWork (file:///apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8650:286)
at file:///apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8994:11
at node:internal/process/task_queues:150:7
at AsyncResource.runInAsyncScope (node:async_hooks:227:14)
at AsyncResource.runMicrotask (node:internal/process/task_queues:147:8) {
code: 'ERR_INVALID_ARG_VALUE'
}
This is an LLM explanation, since I am not familiar with runtime differences.
What is happening:
During prerendering, the bundler (Vite/Nitro) resolves the "edge" build of React DOM Server (react-dom/server.edge.js).
React 19 uses an undocumented Cloudflare Workers extension for web streams called "Direct Readable Streams". It explicitly tries to create a stream using new ReadableStream({ type: 'direct' }) to optimize stream pushing.
Node.js and Bun's standard ReadableStream implementations strictly follow the web spec. According to the standard, type can only be "bytes" (or undefined). When the Bun environment sees "direct", it throws the ERR_INVALID_ARG_VALUE error.
When i change the preset to "node" and try to build this, I do not get this error.
Additional context
No response
Logs
╭───────── [Build Info] ───────────╮
│ │
│ - Build Directory: .output │
│ - Date: 5/11/2026, 11:10:53 AM │
│ - Nitro Version: 3.0.1-alpha.2 │
│ - Nitro Preset: bun │
│ │
╰──────────────────────────────────╯
ℹ Spawning preview server... 11:10:53 AM
ℹ bun run ./server/index.mjs 11:10:53 AM
➜ Listening on: http://localhost:44407/ (all interfaces)
Port 3000 is in use, trying another one...
Port 3001 is in use, trying another one...
Port 3002 is in use, trying another one...
[prerender] Prerendering pages...
[prerender] Concurrency: 8
[prerender] Crawling: /
[prerender] Crawling: /contact
[prerender] Crawling: /privacy-policy
[prerender] Crawling: /projects
[prerender] Crawling: /schedule
[prerender] Crawling: /diagnostic/completed
[prerender] Crawling: /cases/
[prerender] Crawling: /diagnostic/
Above is the working version (last alpha release)
This is the later versions:
╭────────── [Build Info] ────────────╮
│ │
│ - Build Directory: .output │
│ - Date: 5/11/2026, 11:16:15 AM │
│ - Nitro Version: 3.0.260429-beta │
│ - Nitro Preset: bun │
│ │
╰────────────────────────────────────╯
Port 3000 is in use, trying another one...
Port 3001 is in use, trying another one...
Port 3002 is in use, trying another one...
[prerender] Prerendering pages...
[prerender] Concurrency: 8
[prerender] Crawling: /
[prerender] Crawling: /contact
[prerender] Crawling: /privacy-policy
[prerender] Crawling: /projects
[prerender] Crawling: /schedule
[prerender] Crawling: /diagnostic/completed
[prerender] Crawling: /cases/
[prerender] Crawling: /diagnostic/
TypeError [ERR_INVALID_ARG_VALUE]: The property 'source.type' is invalid. Received 'direct'
at new ReadableStream (node:internal/webstreams/readablestream:278:15)
at file:///workspaces/codus/apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:9049:18
at completeShell (file:///workspaces/codus/apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8549:3)
at finishedTask (file:///workspaces/codus/apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8581:38)
at performWork (file:///workspaces/codus/apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8650:286)
at file:///workspaces/codus/apps/web/.output/server/_libs/@tanstack/react-router+%5B...%5D.mjs:8994:11
at node:internal/process/task_queues:150:7
at AsyncResource.runInAsyncScope (node:async_hooks:227:14)
at AsyncResource.runMicrotask (node:internal/process/task_queues:147:8) {
code: 'ERR_INVALID_ARG_VALUE'
}
- Lenguaje dominante
- TypeScript
- Estrellas
- 11.5k
- Forks
- 968
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 64
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nitrojs/nitro
-
pending triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 2 días
-
cloudflare: `nitro deploy` fails when a parent directory has a Wrangler configPosiblemente ocupada @draarivpatel-ui la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 2 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
-
pending triage
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
nitrojs/nitro#5205 · 1 reacción ·
Los mantenedores suelen responder en 2 días
Todos los issues de nitrojs/nitro
Issues similares
-
bug data-types
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
ClickHouse/clickhouse-js#1293 ·
Los mantenedores suelen responder en 1 día
-
area: middleware enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
agent/quality testing
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
juspay/agent-distro#203 ·
Los mantenedores suelen responder en 1 día