Devtools events lost when using Nitro v3 (worker_threads isolates globalThis)
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 499
- Forks
- 100
- Merge medio
- 1 d 17 h
- PR fusionados (30 d)
- 4
Descripción
TanStack Devtools version
0.9.13
Framework/Library version
TanStack Start v1.149.3, Nitro v3.0.1-nightly
Describe the bug and the steps to reproduce it
When using TanStack Start with the nitro() Vite plugin (Nitro v3 nightly) rather than nitroV2Plugin, devtools events emitted from server code never reach the devtools panel.
The root cause is that Nitro v3's NodeEnvRunner runs server code in a worker_threads Worker during dev. EventClient dispatches events to globalThis.__TANSTACK_EVENT_TARGET__
inside the worker thread, but ServerEventBus is listening on a different globalThis.__TANSTACK_EVENT_TARGET__ in the Vite main thread. The events are emitted but never received.
This doesn't happen with nitroV2Plugin because that plugin is build-only — in dev, Start uses its own RunnableDevEnvironment which runs in-process and shares the same global scope.
Steps to reproduce:
- Set up a TanStack Start app using
nitro()(Nitro v3) instead ofnitroV2Plugin - Emit devtools events from server code (e.g. TanStack AI streaming, or any library using
@tanstack/devtools-event-client) - Open the devtools panel — server-side events are missing
Workaround:
We confirmed the issue by manually bridging events from the Nitro worker to the Vite process over HTTP — intercepting tanstack-dispatch-event on the worker's
globalThis.__TANSTACK_EVENT_TARGET__ and POSTing the payload to a Vite dev server middleware that re-dispatches it on the main thread's event target. This works but is hacky.
Apologies for the double-post — originally mentioned this in Discord, just filing here too since it might be easier to track.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
n/a
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
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.
Línea de trabajo
Empieza rastreando EventClient y ServerEventBus alrededor de globalThis.TANSTACK_EVENT_TARGET, y luego reproduce el problema con el plugin de Vite nitro() y la configuración de Nitro v3 worker_threads descrita en el issue. Compara los límites entre el worker y el hilo principal de Vite, y verifica que los eventos de Devtools del lado del servidor lleguen al panel sin el workaround HTTP.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript, vite
- Área
- backend-api-design, devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100