[nu-demo] Settings → Environment page errors with 'expected value at line 1 column 1' — WASM hits unrouted /config/env #199
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
In hero_os Settings → Environment tab on herodemo (and any nu-demo deploy), the page renders only the error banner:
No env vars show. The error is a JSON parse failure — the response body is HTML (nginx 404 / auth challenge), not JSON.
Root cause
hero_os_app/src/services/env_service.rs:18-25builds the RPC URL via:In same-origin mode (the default for nu-demo behind nginx + hero_router),
osis_url()returns"", so the WASM POSTs tohttps://herodemo.gent01.grid.tf/config/env.hero_router parses paths as
/<service>/<socket_type>/<rest>(e.g./hero_osis/ui/whatever→ routes tohero_osis/ui.sock)./config/envdoesn't match this pattern — hero_router rejects it (Socket 'web_env.sock' not found for 'config'→ 404), and nginx returns its default error page (HTML).Verification on herodemo
Hitting hero_router (port 9990) with the correct prefix returns the JSON the page expects:
Backend (
hero_osis_ui/src/lib.rs:83.route("/config/env", post(config_env::config_env_rpc))) is fine — it serves on/config/envand the router strips the service+socket prefix correctly. The bug is entirely in the WASM URL builder.Fix
hero_os_app/src/services/env_service.rs:18:Or, more in line with how the OSIS SDK already prefixes its calls (see
hero_os_app/src/config.rs:37— "The OSIS SDK appends/hero_osis_<domain>/rpcitself per call"): introduce a siblingosis_ui_url()helper that returns the legacy hero_osis_ui prefix, and have env_service use it.Impact / scope
Only the Settings → Environment tab is affected — but it's a visible front-page UX error any new operator hits when trying to set up API keys. (When the API keys tab is broken, the natural next step — running the AI Assistant — also fails until the keys are set via env vars or
~/.profile, compounding confusion.)Not related to the rc.12 ONNX work (home#173 follow-up). Pre-existing.
Filed during herodemo end-to-end testing 2026-04-27. Surfaced when the user opened Settings → Environment to set API keys.
Signed-off-by: mik-tf
Fix landed
hero_os
3dedbd2on development:Verified on herodemo:
/hero_osis/ui/config/envreturns the full env list; bare/config/envreturned hero_router's 404. WASM rebuild + redeploy needed for the fix to reach the browser, which will happen on the next hero_demo deploy fromdevelopment.Closing once that deploy lands.
Signed-off-by: mik-tf
WASM redeployed to herodemo + regression-prevention layer
All three layers landed:
Pragmatic (live)
developmentand assets reinstalled to/home/driver/hero/share/hero_os/public/on herodemo (Apr 27 21:31).hero_router_urlsymbol confirmed in the deployedhero_os_app_bg.wasm./hero_osis/ui/config/envconfirmed serving full env JSON via hero_router (10.1.2.2:9990).Long-term — code
b7b7b90addedconfig::hero_router_url(service, sock_type, path)and refactoredenv_serviceto use it.hero_os_app/src/config.rsand run as part of everycargo test -p hero_os_app --bins:test_hero_router_url_same_origin— the exact regression casetest_hero_router_url_health_probetest_hero_router_url_strips_leading_slash_on_pathtest_hero_router_url_never_drops_service_prefixLong-term — docs
644b417— runbook §4.5 WASM ↔ service URL routing convention. Front-and-center inDEPLOYMENT_NU_HERO_OS.mdso any new contributor reading the deploy doc sees the convention before they write their first WASM RPC call.Why this wont regress
format!("/...")builds for service URLs stand out at PR review against the canonicalhero_router_url(...)call.Closing.
Signed-off-by: mik-tf