Just did a fresh install on Macos. Trying to start...
# proj-agent-canvas
e
Just did a fresh install on Macos. Trying to start any convo on Local agent server results in this:
q
latest commit on main fixes this
e
cool
Still not working for me 😞
a
Are you doing the npm or docker approach? The docker one didn't work for Chuck or myself, so we are doing the npm route.
e
I'm installing from main:
Copy code
git clone <https://github.com/OpenHands/agent-canvas.git>
cd agent-canvas
npm install
npm run dev
nod 1
h
Anything in console and terminal related to the failures? CORS etc
e
Access to fetch at 'http://127.0.0.1:8000/api/conversations' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
h
Resetting local to test as well
I've not been able to replicate. Is your local storage already clear @elegant-branch-54423? I recall running into those at some point but it never stuck around after resetting things
e
Want to walk thru it together? I've been hard refreshing and am basically stuck now
h
yea!
e
To close the loop, it seems like doing a
localStorage.clear()
is not enough. If you click Application > Clear Site Data , that did the trick for me. Are we storing / have we stored data in the browser outside of localStorage?
q
@nutritious-balloon-65098 can you check openhands/agent-canvas repo as to why clearing site data was required?
n
I'm on it! Rohit Malhotra can track my progress here.
Summary This was a pure investigation — no code changes were made. Here's the answer to the question: Why "Clear Site Data" Was Required (Not Just localStorage.clear()) Root cause: Both dev scripts (
dev-with-automation.mjs
and
dev-safe.mjs
) set
VITE_BACKEND_BASE_URL: "<http://127.0.0.1:${port}>"
, which Vite bakes at compile-time into the JS bundle. On first page load, the frontend seeds
openhands-backends
in localStorage with
host: "<http://127.0.0.1:8000>"
. When the browser opens the app at
<http://localhost:8000>
, every API call goes cross-origin to
<http://127.0.0.1:8000>
— which the browser treats as a different origin per CORS spec — and the ingress has no
Access-Control-Allow-Origin
header. Why
localStorage.clear()
doesn't fix it:
Clearing localStorage removes
openhands-backends
, but the page immediately re-seeds it on reload — reading
VITE_BACKEND_BASE_URL
from the same cached JS bundle — so it writes
<http://127.0.0.1:8000>
right back. Nothing changes. Why "Clear Site Data" fixes it: It also purges the browser's HTTP cache, forcing a re-download of the JS bundle from the dev server. If the user had pulled a code fix that changed
VITE_BACKEND_BASE_URL
to
""
, the fresh bundle now makes
getAgentServerBaseUrl()
fall back to
window.location.origin
(
localhost:8000
), so the re-seeded backend is same-origin and CORS is avoided. The proper fix (in branch
origin/fix/remote-loopback-backend-origin
, not yet merged, 157 commits behind main): set
VITE_BACKEND_BASE_URL: ""
in both dev scripts. The Vite server-side proxy (
VITE_BACKEND_HOST
) already handles routing
/api/*
to the backend — the client-side env var should be empty so browser fetches stay same-origin. Also missing: a one-time migration in `storage.ts`'s
readStoredBackends()
to automatically normalize stale
127.0.0.1
hosts to match
window.location.hostname
, so existing users don't need to manually clear anything after the fix lands.