Environment: anna.partners dashboard, Chrome 156 on Windows 11, @anna-ai/cli v0.1.63 (app-schema / dispatcher 0.32.0), SDK from /static/anna-apps/_sdk/latest/index.js. UI-only App (static-spa, no Executa), App ID 748.
What happens
My App has a second HTML page in the bundle (desk/game.html) and moves to it with location.assign(). On that page, and again when coming back to index.html, AnnaAppRuntime.connect() throws:
[anna-sdk] missing wid/t URL parameters
connect() only reads wid and t from location.search. Any in-app navigation that builds a new query string loses them. The page then runs with no host: storage reads return the defaults, so the user sees an empty or reset App. Saves fail, so no data is lost, but it looks like data loss.
Steps to reproduce
- Bundle
index.htmlandpage2.html, and have both callAnnaAppRuntime.connect(). - In
index.html:location.assign('page2.html?foo=1'). page2.htmlfails to connect.
Two more traps once you carry the URL over
- Stale token: the
tin the iframe URL is the token from when the window opened. The SDK keeps the refreshed one inruntime.token(updated onauth.refresh), but the URL still holds the original. In the dev harness the token TTL is about 30 s. I haven’t measured it in production, but a page switch minutes later should useruntime.token, not the URL value. langcollision: the host putslang=en-USon the URL and the SDK reads it intoruntime.locale. My game pages used?lang=vifor their own language. After returning, the App readvias the host locale and switched its UI language.
Workaround
Keep every host key, swap in the latest token, and use App-specific key names:
// own keys = the App's params; everything else on the URL belongs to Anna
function pageQuery(search, own, token) {
const q = new URLSearchParams(search);
for (const k of ['view', 'tab', 'game', 'back', 'glang']) q.delete(k);
if (token) q.set('t', token);
for (const [k, v] of Object.entries(own)) if (v) q.set(k, v);
return q.toString();
}
location.assign('page2.html?' + pageQuery(location.search, { glang: 'vi' }, runtime.token));
Suggestions
- Document that
wid,t,theme,themeModeandlangare host-owned URL keys that must survive in-app navigation. - Add an SDK helper, e.g.
runtime.pageUrl(path, params), that carries them over with the current token. - Alternatively, let
connect()fall back to credentials kept insessionStorageperwid, so a plainlocation.assignkeeps working.