fix: Windows Bad Gateway — Vite killed by unquoted path in spawnService shell#716
fix: Windows Bad Gateway — Vite killed by unquoted path in spawnService shell#716jamiechicago312 wants to merge 1 commit into
Conversation
|
@jamiechicago312 is attempting to deploy a commit to the openhands Team on Vercel. A member of the Team first needs to authorize it. |
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ LGTM - Clear documentation of a Windows-specific workaround.
The note is well-placed in the quickstart section, accurately describes the symptom, and provides a concrete solution. The workaround script exists and is the correct path for direct stack invocation.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Documentation-only change with no code modifications. Adds user-facing guidance for a known Windows path issue. No breaking changes possible.
Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/OpenHands/agent-canvas/actions/runs/26243249005
| > **Windows:** `npm run dev` may show a Bad Gateway error if Vite exits with a `C:\Program` path error. Run the dev stack directly instead: | ||
| > ```powershell | ||
| > $env:PYTHONUTF8 = "1" | ||
| > node --env-file-if-exists=.env .\scripts\dev-with-automation.mjs |
There was a problem hiding this comment.
Hmm npm run dev simply wraps node --env-file-if-exists=.env scripts/dev-with-automation.mjs command
Unclear to me why one fails but the other works
There was a problem hiding this comment.
Is there a workaround that allows npm run dev to work? Because once we release the npm package it would be great if they could use it directly
There was a problem hiding this comment.
That is the thing. I got this error for the first time I used agent canvas last week. And then earlier this week it worked great. and then i got bad getaway again!
@OpenHands can you investigate the codebase. What would need to change so windows, mac, and linux can run without running into bad getaway at all so that a user after npm install can just run npm run dev
There was a problem hiding this comment.
Uh oh! There was an unexpected error starting the job :(
|
Superseded by #734, which fixes the root cause in code rather than documenting a workaround. The actual bug was a one-line ordering issue in Closing this in favour of #734. This comment was added by an AI agent (OpenHands) on behalf of the user. |
Fixes #715
Root Cause
buildNpmScriptCommand()inscripts/dev-safe.mjsreturnsprocess.execPathas the command whennpm_execpathis set (i.e. when launched vianpm run dev):spawnService()inscripts/dev-with-automation.mjsthen spawns that command withshell: trueon Windows:Node passes the command to
cmd.exeunquoted, socmd.exeseesC:\Programas the executable and errors out — killing Vite before the ingress starts, which causes Bad Gateway onlocalhost:8000.This affects any Windows user whose Node.js is installed in
C:\Program Files\(the default installer path), regardless of clean or existing install.Changes
dev-with-automation.mjs)Suggested code fix (follow-up)
Remove
shell: process.platform === "win32"fromspawnService(). Whennpm_execpathis set,buildNpmScriptCommandalready returns a fullnode.exepath —shell: falsespawns it correctly. When it isn't set (Windows non-npm path),buildNpmScriptCommandreturnscmd.exeas the command explicitly, so no shell wrapping is needed there either.This PR was created by an AI agent (OpenHands) on behalf of the user.