Chapter 21
Troubleshooting and FAQ
| Symptom | Cause and fix |
|---|---|
| "Web Crypto unavailable" | The page isn't in a secure context. Use HTTPS or localhost (§17.3). |
421 Unknown host |
The Host header isn't allowed. Add it via EXTRA_ALLOWED_HOSTS. |
403 Your session expired |
Missing or expired session cookie or CSRF token. Fetch /api/session again (the demo retries once). |
400 Secure fields could not be verified |
Plaintext password sent, stale challenge, or wrong field name in sealSecret. Always store the challenge from every response. |
| Text looks blurry | Set autoDensity: true and a resolution (devicePixelRatio, capped at 2). |
| Wrong font metrics or overlapping caret | The font loaded after the UI was created. Await document.fonts.ready, or call ui.setTheme(ui.theme). |
| Keyboard doesn't open on iOS | Focus must come from a user tap. Don't call control.focus() from timers. |
| Clicking the canvas doesn't focus the field | Something else is calling preventDefault on pointerdown, or another element covers the canvas. |
A custom control throws undefined in drawBody |
Guard against fields that aren't initialised yet, and call redraw() at the end of the constructor. |
| Infinite loop / "Maximum call stack" in layout | A custom container re-lays out on child resize while laying out. Add a laying guard (§10). |
| A Go decryptor panics on the regex | RE2 caps repeats at 1000. Use {22,} plus a length check (already done in server/decrypt/go). |
| An embedded form shows a tinted rectangle | Transparent canvases must clear to black at alpha 0 (premultiplied alpha). mountPixiForm does this; if you create the Application yourself, use background: 0x000000, backgroundAlpha: 0. |
| Two canvases appear in React dev mode | You mounted without the cancellation guard. Use the provided PixiFormUI.tsx wrapper. |
| Angular app becomes slow when a form is visible | The form was mounted inside the Angular zone. Use the provided component (it uses runOutsideAngular). |
Can I use PixiFormUI without the bundled server? Yes. The library is front-end only. Implement the session,
CSRF and challenge endpoints in your back end and use a decryptor from server/decrypt/.
Can I use React/Vue/Svelte? Yes. The simplest way is mountPixiForm() (§23).
To build forms by hand, create the Application in a component's root element on mount, create the FormUI
there, and call form.destroy(), ui.destroy() and app.destroy() on unmount.
Can I draw my own content next to the form? Yes. Build it from the renderer primitives (Container,
Graphics, Text) and add it to ui.content (or the stage).
How do I prefill values? Use the value/checked options, or control.setValue(v, false) (no events).
Password fields can't be prefilled with plaintext, by design.