Skip to content

fix: run Nitro in-process in Start WebContainers - #1279

Merged
tannerlinsley merged 1 commit into
mainfrom
fix/webcontainer-nitro-self-runner
Sep 17, 2026
Merged

tannerlinsley merged 1 commit into
mainfrom
fix/webcontainer-nitro-self-runner

Conversation

@AlemTuzlak

@AlemTuzlak AlemTuzlak commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

After the Rolldown WASI load and the standalone example tsconfig, Vite starts. The first request then fails with Vite environment "nitro" is unavailable.

Nitro's default runner is node-worker. In WebContainer that worker never finishes loading the nitro entry. This PR runs Nitro in-process (self) for the Start sandbox profile only. Query, Table, Charts, and other esbuild sandboxes stay unchanged.

Testing

Commands run:

  1. Isolated Basic Chat with the sandbox Vite wrapper (vite --config .tanstack/vite.config.mjs) returned HTTP 200 locally.
  2. The same boot with NITRO_DEV_RUNNER=self returned HTTP 200.
  3. pnpm exec tsx --test tests/example-webcontainer-start.test.ts passed.
  4. Pre-commit pnpm run test: 525 passed, 3 skipped.

Manual test after deploy:

  1. Open https://tanstack.com/ai/latest/docs/framework/react/examples/basic-chat
  2. Wait for Vite to start.
  3. Confirm the preview loads the chat UI.
  4. Confirm there is no Vite environment "nitro" is unavailable error.

Risk / rollback

Start docs sandboxes get the same in-process Nitro runner. Revert this PR to restore node-worker.

Summary by CodeRabbit

  • Bug Fixes

    • Improved TanStack Start development environments by configuring the Nitro development server to run in the WebContainer context.
    • Added the required environment setting for consistent WebContainer startup behavior.
  • Tests

    • Added coverage verifying the WebContainer environment and generated development-server configuration.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 50f27d4e-cc50-4e2f-82a3-00f608fca105

📥 Commits

Reviewing files that changed from the base of the PR and between 9a00f44 and 5d0c3c1.

📒 Files selected for processing (2)
  • src/utils/example-webcontainer-start.ts
  • tests/example-webcontainer-start.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The async-context WebContainer setup now selects Nitro’s self runner in its environment and generated Vite configuration. Tests verify both settings.

Changes

WebContainer Nitro runner

Layer / File(s) Summary
Configure and validate the Nitro self runner
src/utils/example-webcontainer-start.ts, tests/example-webcontainer-start.test.ts
The WebContainer environment sets NITRO_DEV_RUNNER to self. The generated Vite configuration sets nitro.devServer.runner to self. Tests verify both values.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 5d0c3

The change is narrowly scoped to Nitro runner configuration, with no established merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: running Nitro in-process in Start WebContainers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tannerlinsley
tannerlinsley merged commit b42cf50 into main Sep 17, 2026
7 checks passed
@tannerlinsley
tannerlinsley deleted the fix/webcontainer-nitro-self-runner branch September 17, 2026 17:47
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.

2 participants