Skip to content

Fix the frontend dev server 404ing every route after the SSR migration - #1347

Merged
ebma merged 3 commits into
stagingfrom
fix/e2e-vite-dedup
Aug 21, 2026
Merged

Fix the frontend dev server 404ing every route after the SSR migration#1347
ebma merged 3 commits into
stagingfrom
fix/e2e-vite-dedup

Conversation

@ebma

@ebma ebma commented Aug 21, 2026

Copy link
Copy Markdown
Member

The nightly e2e run failed with Timed out waiting 120000ms from config.webServer. The same breakage also affects bun dev locally, so this is not CI-only.

What broke

Vite lists lightningcss as an optional peer, and @tanstack/start-plugin-core depends on it directly. Bun therefore resolved that peer only for the plugin and installed a second copy of Vite (vite@7.3.6+859f710… next to the app's vite@7.3.6+4d96f45…).

TanStack Start decides whether to install its SSR dev middleware with isRunnableDevEnvironment(env), which is an instanceof check. Across two Vite copies that check cannot match, and the plugin returns silently — no warning, no error. The result:

  • vite dev starts normally ("ready in 1.3s") but nothing handles requests, so every route falls through to connect's 404 Cannot GET /.
  • Playwright's webServer probe accepts only 200 <= status < 404, and its /index.html fallback also 404s because Improve SEO by prerendering marketing pages to static HTML #1333 removed index.html. It polls for the full 120s and fails the job.

I confirmed this by instrumenting the plugin at runtime: the SSR environment is a RunnableDevEnvironment, but the plugin's check resolves from the other Vite copy and reports runnable: false.

Nothing caught it at PR time because the e2e workflow only runs on schedule / workflow_dispatch, never on PRs.

The fix

Adding lightningcss as a direct devDependency of apps/frontend makes bun resolve the same optional-peer set at both positions, collapsing to a single Vite copy. It is one line in bun.lock (the package was already resolved as a transitive dependency), and bun install --frozen-lockfile still passes.

apps/frontend/src/tests/vite-single-instance.test.ts asserts that the app and the Start plugin resolve the same Vite module, and carries the rationale for the otherwise-unused dependency. It fails with the exact duplicate-copy mismatch when the dependency is reverted, so it genuinely guards the regression.

Second issue

Both "Upload report on failure" steps warned No files were found. The CI reporter list had no html reporter, so playwright-report/ was never written and a red nightly left nothing to debug from. Added it to both the frontend and dashboard configs.

Verification

Clean worktree at origin/staging:

Check Before After
Frontend e2e webServer timeout 15 passed
Dashboard e2e 65 passed 65 passed
New regression test fails passes
Frontend unit tests 171 passed (24 files)
typecheck / lint / frontend build clean, 22 pages prerendered

ebma added 2 commits August 21, 2026 11:49
Vite lists `lightningcss` as an optional peer and `@tanstack/start-plugin-core`
depends on it, so bun installed a second copy of Vite for the plugin. TanStack
Start gates its SSR dev middleware on `isRunnableDevEnvironment()`, an
`instanceof` check, which cannot match across two copies — the plugin returned
without installing anything and left `vite dev` answering every route with a
connect 404.

That broke `bun dev` and the nightly Playwright journeys, whose webServer probe
only accepts a status below 404 and whose `/index.html` fallback disappeared
with the SSR migration.
The e2e workflow uploads `playwright-report/` on failure, but the CI reporter
list produced only terminal output, so both upload steps found nothing and a
red nightly run left no artifact to debug from.
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 6323aa0
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6a88215c824dc500088c7cc8
😎 Deploy Preview https://deploy-preview-1347--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit 6323aa0
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6a88215c071c6a0008db48a4
😎 Deploy Preview https://deploy-preview-1347--vortexfi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for vrtx-dashboard canceled.

Name Link
🔨 Latest commit 6323aa0
🔍 Latest deploy log https://app.netlify.com/projects/vrtx-dashboard/deploys/6a88215c93afb6000865ae03

The rationale lives in `src/tests/vite-single-instance.test.ts`, next to the
assertion that enforces it.
@ebma
ebma merged commit 6911b35 into staging Aug 21, 2026
6 checks passed
@ebma
ebma deleted the fix/e2e-vite-dedup branch August 21, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant