Nitro adapter fails in dev: Vite environment "ssr" is unavailable on Windows #7717
-
|
Hi, Environment: What works What fails Things what i tried : Is the Nitro deployment adapter currently expected to work on Windows with Node.js v22.17.0 and Vite 8? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
This looks like Nitro's Vite dev worker race, not the OpenAPI generator. The same So I would treat Nitro as supported for build/deploy, but flaky in dev with this version combo. Practical workarounds are: reload once after the dev server finishes warming up, pin/try a newer |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the suggestion. I investigated it further and it looks slightly different in my case. I reproduced the issue in a completely fresh TanStack Start project with the Nitro adapter enabled. There is no hey-api integration and no generated code involved. Here are my findings: npm run build completes successfully. I also tried the proposed workaround by increasing the retry loop in dev-worker.mjs from 5 attempts to 600 attempts. Unfortunately, it did not resolve the issue. Instead, the request eventually times out with: transport invoke timed out after 60000ms This makes me think the problem is not simply that the SSR entry takes longer than the retry window. It looks like the Nitro dev worker never successfully initializes the SSR environment (or the Vite worker communication gets stuck), while the production build works correctly. Environment: TanStack Start 1.168.26 |
Beta Was this translation helpful? Give feedback.
-
|
This matches a known, still open Nitro bug rather than anything specific to the OpenAPI generator or the project setup. nitrojs/nitro#4295 documents the exact same error and stack trace ( The root cause described there: That issue is still open with no merged fix as of the most recent nitro-nightly builds, so upgrading nitro-nightly alone likely won't resolve it yet. Two practical paths while it's unresolved: Patch the retry loop locally with patch-package or pnpm patch, replacing the fixed 5-iteration backoff in Or keep Worth noting nitro-nightly is exactly what it says, a rolling nightly channel with several builds published per day, so there isn't really a stable known-good version pin to recommend today for this combination. |
Beta Was this translation helpful? Give feedback.
This matches a known, still open Nitro bug rather than anything specific to the OpenAPI generator or the project setup. nitrojs/nitro#4295 documents the exact same error and stack trace (
ViteEnvRunner.fetchthrowingVite environment "ssr" is unavailablefromdev-worker.mjs).The root cause described there:
ViteEnvRunner.fetchwaits for the SSR entry module to finish importing, but only retries 5 times with exponential backoff, roughly 100+200+400+800+1600ms, about 3.1 seconds total. On a project where the SSR entry's first cold transform takes longer than that (larger dependency graphs, slower disk access, which Windows tends to be more prone to than macOS/Linux for cold node_modules read…