Skip to content

Troubleshooting

David Reed edited this page Nov 20, 2026 · 2 revisions

Symptoms you can hit when you embed or deploy STomp, what causes each one, and what to do about it. Each cause here was checked against the code on master, and the deployment ones were reproduced with the configs from Deploy STomp. The FAQ is at the end.

Where to look

STomp writes to three consoles, and the message you need is often not in the first one you open.

Console How to open it What it shows
the host page's DevTools on your page the controller's messages, and with the default "top" context also those of the controller frame and the proxied frames
the service worker's chrome://inspect/#service-workers, or DevTools on a tab of the origin that serves dist/, Application, Service workers, "inspect" routing errors, request rules that were skipped, the content blocker, controllers that are gone
a proxied page's pick the frame in the console's context menu rewriter errors, hook errors, a build mismatch between the page and the worker

Two switches add detail:

  • onRequest on the controller reports every proxied request with its real URL, status, time and, on a failure, error and kind. It is the quickest way to see what a page asked for and what failed.
  • debugTransport: true in the controller's init, or localStorage['stomp:debug-transport'] = '1' on the host origin and a reload, prints a [net] line for each connection the transport opens. The [wisp] lines (which relay, WebSocket or WebTransport) are printed either way.

When a site hangs or a WebSocket stops receiving messages, suspect the transport before the rewriter. With a StompController, reproduce the request with controller.transport.request() (or .connect() for a socket) from the host page's console, so nothing is rewritten in the path. If the bare request fails the same way, the problem is in the transport or the relay.

The controller does not start

RemoteController.wait() never settles

wait() waits for the controller frame on the proxy origin to say it is ready, with no timeout. Anything that stops that frame from loading or starting leaves the promise pending. Find controller.element (the hidden iframe titled "Stomp controller") in the Elements panel, open its URL in a tab, and check these in order:

What you find Cause Fix
Framing 'https://proxy.example.com/' violates the following Content Security Policy directive: "frame-src ..." (or "default-src ...") in the host console the host page's CSP has no frame-src (or default-src) for the proxy origin add the proxy origin to frame-src (the host page's CSP)
no message at all; the frame shows Chrome's "blocked" page the host page is cross-origin isolated and controllerFrame.html has no Cross-Origin-Resource-Policy: cross-origin send CORP and COEP on every file of the proxy origin's /stomp/
StompRemoteController is not defined and net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep the same, for Controller.js loaded from the proxy origin the same
the frame reads This page is the Stomp controller frame; it only works embedded by a host application. the frame got no referrer: the host page sends Referrer-Policy: no-referrer or same-origin (with origins in stomp-allowed-origins, the frame stays blank instead) use the default policy, origin or strict-origin (Keep the referrer)
the frame reads Embedding origin is not allowed. stomp-allowed-origins in controllerFrame.html does not list the host page's origin list the exact origin, scheme and port included
the frame is your server's 404 page proxyOrigin or directory does not point at where dist/ is served directory is the path dist/ is mounted at, with the trailing slash (default /stomp/)
the same Framing ... violates line, but naming "frame-ancestors ..." the frame-ancestors you send on controllerFrame.html names another origin name the host page's origin, scheme and port included

A service worker that stays in installing also keeps the frame from starting. That shows in the proxy origin's Application panel.

wait() rejects with StorageBlockedError

The message reads: the browser blocks storage for https://proxy.example.com inside https://app.example.com (third-party cookies are blocked), so the proxy cannot register its service worker.

The host page and the proxy origin are two sites, and the browser blocks third-party storage (Brave and incognito windows by default, a setting in Chrome). A frame of another site then gets no service worker. Chrome's own error says only "The user denied permission to use Service Worker"; STomp checks document.hasStorageAccess() and gives the error this name and message instead. The cause property holds the browser's error.

Fix: serve both origins from one site, app.example.com and proxy.example.com (Keep both origins on one site). localhost and 127.0.0.1 are two sites, which is why the local demo hits this. As a fallback the host can catch the error and start a same-origin StompController instead, which is what the demo does for its local default, but that gives up the isolation. Telling the user to allow third-party cookies for your host is the other way out.

Your browser does not support service workers.

StompController.register() rejects with this, and the constructor throws it, when navigator.serviceWorker is missing. Almost always the page is not a secure context: it is on plain http: on a name other than localhost, 127.0.0.1 or *.localhost. Serve it over HTTPS.

Stomp: the host does not serve the asset 'core'

wait() rejects with this when the controller could not load or compile core.wasm, the rewriter's module. The controller loads it whichever rewriter you pick. Two causes:

  • The file is not there: a 404 for core.wasm in the Network panel. Serve all of dist/, or tell the controller its name with init.assets.core if you renamed it.
  • The host page's CSP refuses WebAssembly. The line before the error says so: Stomp: the core module did not load CompileError: WebAssembly.compile(): Compiling or instantiating WebAssembly module violates the following Content Security policy directive because 'unsafe-eval' is not an allowed source of script. Add 'wasm-unsafe-eval' to the page's script-src. This happens with StompController, where the page compiles the module; with RemoteController the controller frame compiles it.

Stomp: the host does not serve the asset 'rewriterLib'

The controller fetches rewriterLib.js from directory when it starts, and every proxied page loads it. The message says what came back instead: a network error, HTTP 404, or a text/html answer. The last one is usually a single-page-app fallback that answers every unknown path with your index.html. Exclude directory from that fallback.

The constructor throws

These come from new StompController() or new RemoteController() before anything starts:

Message Cause
RemoteController needs a proxy origin different from the host origin; use StompController for same-origin setups proxyOrigin is the page's own origin
Stomp directory must be same-origin directory of a StompController is a URL on another origin
Stomp errorPage must be same-origin errorPage is on another origin (with RemoteController, it is a path on the proxy origin)
Stomp: a controller id is 1 to 32 characters of [A-Za-z0-9_-], not ... init.id has another character or length
Stomp names... (is not an identifier, is a global of this page, is used twice) a bad init.names entry
Stomp hooks... (must be { source } or { url }, is not a phase) a malformed init.hooks
No service worker in the registration for ... the registration you passed holds no worker: its script failed to install

setTransport() throws a TypeError when you hand it the wrong kind of transport: a descriptor where the transport runs in the page, or an instance where it runs in the transport worker. controller.transportHost says which.

StompController.wait() never settles

register() itself rejects when serviceWorker.js cannot be fetched or is not served as JavaScript; check that it loads at <directory>serviceWorker.js. If registration worked and wait() still hangs, the service worker never answered the controller: look in the service worker's console for Stomp: failed to create server, and for a worker stuck in installing in the Application panel. register() stops waiting for activation after 30 seconds and hands back the registration as it is, so a stuck worker shows up as a pending wait(), not as a hang of register().

Pages do not load

An error occurred. (500) and the wisp WebSocket closed before the relay spoke

The frame shows STomp's built-in error page, and the host console has:

[wisp] websocket did not open (the wisp WebSocket closed before the relay spoke)

The transport could not open its WebSocket to the relay. In order of likelihood:

  1. The reverse proxy does not forward the upgrade. nginx needs proxy_http_version 1.1 and the Upgrade and Connection headers set in the /wisp/ location; reproduced by removing those two lines from the nginx config.
  2. The wisp server is down, or the reverse proxy points at the wrong port.
  3. The wisp URL is wrong: a path the relay does not serve, or ws:// from an https: page, which the browser refuses as mixed content.
  4. The relay refuses the origin: holyWisp with allowedOrigins answers 403 to an Origin it does not list. With RemoteController that origin is the proxy origin, not the host's.

Test the relay alone with curl -i --http1.1 -H 'Connection: Upgrade' -H 'Upgrade: websocket' -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' https://proxy.example.com/wisp/. A working relay answers 101 Switching Protocols.

The page says 500 because no errorPage is set. With one, the same failure reaches your page as kind transport with status 502 (next section).

The error page and its kinds

Set errorPage to a page of your own (see examples/error.html) and a document the proxy failed to produce shows that page, under the frame's URL, with globalThis.stompError = { url, status, error, kind } in its head. location.reload() in it retries the real page. The same kind (and error) appears in onRequest reports for the request.

kind Status What happened What to do
transport 502 the transport failed: the relay is unreachable, the connection dropped, the transport did not load read error; check the relay as above
routing 404, 500 or the error's own STomp could not route the request: a URL that should not have been routed, an internal error, an inline document that is unknown, used or expired the service worker's console has the error and its stack; report a reproducible one as a bug
blocked 403 a request rule of yours with action: 'block', or the content blocker refused a top-level navigation onRequest's rule names the rule's index; adblock: false turns the blocker off
controller 410 or 404 the routed URL names a controller that is gone, and no live controller with the same codec can take it over open the host page again; keep codec and directory stable across deploys
timeout 504 only with an internal test option; STomp sets no request timeout of its own none needed

A subresource that fails gets no page: the request fails in the page as a network error, and onRequest reports status 0 with error and kind. Mixed content and blocked subresources report kind: 'blocked' with an error such as blocked: mixed content or blocked by the content blocker.

Stomp: no transport (...)

Every request fails with this text when the controller has no working transport. The host console says why, earlier:

  • Stomp: the transport worker could not host the transport, hosting it in the page, followed by the transporthost event (detail: { host: 'page', error }). The transport worker did not start or could not import the module, and the page imported it instead. Common causes: transportWorker.js is missing, it has no Cross-Origin-Embedder-Policy under an isolated page, or the module's MIME type is wrong. STomp still runs, but a proxied page's synchronous XHR that needs the network now blocks the thread the transport runs on.
  • Stomp: the transport module could not be imported. The page could not import it either. Check that the module URL loads and is served as JavaScript (.mjs on nginx needs a types entry, see Caching), and that it is on the proxy origin with RemoteController. After a fix, setTransport() swaps in a new transport without a reload.

The frame shows your own server's 404 page

The request went past the service worker to your server. That happens when:

  • the service worker is not controlling the frame yet (the first load after registering, before wait() resolved), or not at all (a 404 or a wrong scope for serviceWorker.js);
  • no host page of this directory is open, and someone opened a copied proxied URL in a new tab: the worker has no live controller to route it with, so it does not answer;
  • a page built an about:blank frame or popup itself. Chrome gives such a document no service worker, so its subresource requests reach your server. That is expected; the nginx config answers script requests from there with an empty script, so Chrome logs no MIME type error for them.

A site works in Chrome but not through STomp

Check the known limitations first, then try once with each of these off for the visit: the content blocker (adblock: false), emulated service workers (serviceWorkers: false), the HTTP cache (cache: false). A script the rewriter cannot parse runs unrewritten by default; allowInvalidJs: false makes it fail loudly with a SyntaxError that names the rewriter error, which tells you whether that is the cause. The service worker's console (or a rewrite worker's) logs Stomp could not rewrite <url>: <reason> for such a script.

After a deploy

The status says stale

controller.stale is { controller, worker } and a stale event fired. The console has:

Stomp: the controller is build <a>, the service worker is build <b>; updating the service worker
Stomp: the controller is build <a>, the service worker is build <b>; the new worker has not activated yet, continuing with the old one and switching when it does

The page's bundle and the service worker are of two builds. Pages still load. Two ways to get here:

  • The tab was open during the deploy. A proxied navigation let the browser install the new worker, which took over, and the old page now talks to it. Nothing newer is coming, so the tab stays stale until it is reloaded. Show the user a "reload to update" notice while stale is set.
  • The page is new and the old worker is still in charge: the update did not finish within 5 seconds (an old worker can be held by a request that never ends). The controller binds to the new worker when it activates and fires rebind. If this happens on every visit, a cache is serving an old serviceWorker.js: see the next section.

A proxied page's console may also say Stomp: this inject bundle is build <x> but the service worker is build <y>; hard-reload the page. It is the same mismatch, seen from the page.

The first site after a deploy stays on "Loading"

The frame keeps its old document (about:blank in a new tab) and go() resolves only after 30 s. Chrome stopped the old service worker while it was answering the navigation. Builds before 4.2.0-nightly.202611200512.g041dc67 do not send such a navigation again; update STomp. What happens in the browser explains the fix.

Users still get the old version

Something caches serviceWorker.js or the files without a hash. STomp registers the worker with updateViaCache: 'none', which bypasses the browser's HTTP cache but not a CDN's. Serve serviceWorker.js and every file not asked for by a hash with Cache-Control: no-cache, and check that your CDN respects it (Cloudflare's Browser Cache TTL overrides origin headers unless a cache rule says otherwise). Caching has the full table.

Isolation and browsers

crossOriginIsolated is false

The host page needs both Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp. Check the page's response headers in the Network panel. Common causes:

  • A reverse proxy or CDN in front drops them.
  • nginx: a location with its own add_header loses every add_header of the server block.
  • credentialless instead of require-corp: WebKit (Safari, every browser on iOS) has no credentialless, and the page is not isolated there.

Without isolation STomp runs as before; only proxied pages that need SharedArrayBuffer notice.

Images or scripts of your own page stop loading after you add COEP

Under require-corp, everything your page loads from another origin needs Cross-Origin-Resource-Policy (or CORS). The console shows net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep for each one. Serve those files from your own origin, ask their server for CORP, or load them with crossorigin from a server that sends CORS headers.

window.open returns null in a proxied page

That is how onOpen works: when you pass it, a page's request for a new tab goes to your callback, and the page's window.open returns null, as with a popup blocker. Open the URL in a tab of your own.

With RemoteController and a cross-origin isolated host, Chrome gives a proxied frame no window for a popup in any case. A sign-in flow that opens a blank popup and then navigates it does not work there. Take popups with onOpen, or drop isolation for that host.

Without onOpen, links with target="_blank" and window.open open the proxied page in a bare browser tab, outside your application.

Permission prompts name the proxy origin, or features are denied

Camera, microphone, geolocation and the other features behind a permission are granted to the origin the browser sees, which is your proxy origin, not the proxied site. In isolation mode a proxied frame gets none of them unless its iframe has an allow attribute that lists them. Chrome never shows the notification prompt to a frame of another origin, so Notification.requestPermission() resolves default there. docs/permissions.md has the details and onPermissionRequest.

Request rules do nothing

init.rules match with URLPattern. A browser without it, or a pattern it cannot compile, skips that rule with one warning in the service worker's console: Stomp: request rule skipped, its url pattern ... cannot be compiled.

Transports and WebSockets

Transports and Wisp explains the choices. The symptoms:

Symptom Cause Fix
pages stop loading after a few dozen requests libcurl-transport stops answering HTTP after about 70 requests (about 160 with a larger pool) use epoxy
YouTube and other big sites fail with PROTOCOL_ERROR the npm build of epoxy resets an HTTP/2 response whose headers are over 16 KiB use the pinned epoxy build (deploy/epoxy), which allows 256 KiB like Chrome
a WebSocket's messages seem to stop after the first round trip the npm build of epoxy holds each frame it writes until the next write use the pinned epoxy build, which flushes each frame
uploads over about 8 MiB, or long-lived streams, stall a wisp server that never refills TCP credit (wisp-js 0.5.2 and older) stalls a stream after 128 packets wisp-js 0.5.3 or newer, or holyWisp
every stream drops at once during an upload, WebSocket close code 1009 one wisp message was larger than the relay accepts, and the relay closed the whole connection the pinned epoxy build writes packets of at most 64 KiB; raise the relay's message limit if you use another transport
the connection drops after a minute without traffic the reverse proxy's idle timeout (nginx proxy_read_timeout, 60 s by default) raise it for /wisp/ (nginx)
http3 is on but nothing goes over HTTP/3 HTTP/3 needs epoxy and a relay that carries UDP; until a handshake works, requests stay on TCP. After 8 refused hosts, QUIC is off for 5 minutes check the console for Stomp: HTTP/3 is off ...; enable UDP on the relay
the first load waits about 3 seconds with webTransport on the network drops UDP; the transport waits for the WebTransport session, then rides the WebSocket for 30 s before it tries again expected on such networks; the WebSocket carries everything
a download keeps growing in memory while paused wisp has no flow control from server to client, so the body keeps arriving none yet

Console messages

The messages a misconfiguration produces, and the section that covers each.

Message (start) Console Meaning
Stomp: the controller is build ..., the service worker is build ... host a deploy is in progress for this tab (After a deploy)
Stomp: this inject bundle is build ... but the service worker is build ... proxied page the same mismatch, seen from the page
Stomp: the transport worker could not host the transport, hosting it in the page host the transport runs in the page (Stomp: no transport)
Stomp: the transport module could not be imported host no transport at all; every request fails
[wisp] websocket did not open (...) host the relay is unreachable (wisp)
Stomp: the core module did not load host core.wasm missing or refused by CSP; wait() rejects next
Stomp: the <name> module did not load host another wasm module is missing; STomp uses its JavaScript fallback for it
Stomp: the content blocker is off, its module did not load host blocker.wasm is missing; pages load unfiltered
Stomp: the content blocker is off: ... service worker the filter lists or the engine could not be fetched or compiled; pages load unfiltered
Stomp: a rewrite worker could not start host rewriteWorker.js is missing or blocked; the service worker rewrites scripts itself, more slowly
Stomp: request rule skipped, ... service worker a rule's URLPattern could not be compiled
Stomp: the host's <phase> hook threw in <url>: ... proxied page your hook threw; also reported to onHookError and the hookerror event
Stomp: the controller at ... is gone and no live controller uses its codec (...) service worker kind controller, 410
Stomp: no controller is registered at ... service worker kind controller, 404
Stomp could not rewrite <url>: ... service worker or worker a script the rewriter could not parse; it runs unrewritten unless allowInvalidJs: false
Stomp: HTTP/3 is off for ... s, the wisp server relays no UDP host the relay carries no UDP; requests stay on TCP
An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing. host Chrome's warning for the proxied frames' sandbox; see the FAQ

A hook URL that cannot be fetched logs nothing: it is reported through onHookError and hookerror with phase: 'url', and the controller runs without that hook.

Known limitations

These are open, and no setting changes them. The full list, with the measurements, is under "Known limitations" in CHANGELOG.md.

  • Cloudflare Turnstile can show "Verify you are human" on every proxied load. All proxied sites share one renderer process; the site pool (sitePool, docs/site-pool.md) gives each site a process of its own and helps.
  • In same-origin mode every proxied frame shares one heap and one event loop with your page, so a busy page slows the others.
  • In isolation mode, Chrome holds requestAnimationFrame for hidden or scrolled-out cross-origin frames, so a background tab's animations stop.
  • HTTP authentication is Basic only. A site that asks for Digest, NTLM or Negotiate shows its 401 page, with no login prompt.
  • A page's CSP violations fire no securitypolicyviolation event, and error line and column numbers are those of the rewritten script.
  • Import maps' URLs are not rewritten.
  • Response header values outside ASCII arrive double-encoded (Chrome's service worker does this; STomp cannot undo it).
  • :visited misses visits made with location.replace, replaceState, a meta refresh, or in tabs the host opened.
  • Aborting a fetch does not cancel it on the transport: the request runs to its end.
  • WebSockets have no permessage-deflate.

FAQ

Can I run STomp on one origin?

Yes, with StompController. Use it for development and in-house tools. A proxied page is then same-origin with your page, and the rewriter's hooks are not a security boundary: a page that slips past them can read your page and its storage. The public demo runs this way on purpose. For anything else, use RemoteController on a second origin of the same site (Deploy STomp).

Why does Chrome warn that the iframe "can escape its sandboxing"?

Proxied frames are sandboxed with allow-scripts and allow-same-origin together: the service worker controls only frames that keep their origin. Chrome warns about that pair because a frame that is same-origin with its parent could remove its own sandbox. With RemoteController the frame is on another origin than your page, so it cannot reach your page to do that. With StompController it can, which is another reason same-origin mode is for development.

Do I need my own wisp server?

No. wss://holywisp.fracit.al/ is a public holyWisp relay and works as the wisp URL. Run your own (holyWisp, or wisp-js 0.5.3 or newer) when you want your own limits, your own exit IP, UDP for HTTP/3, or allowedOrigins so that only your proxy origin can use it.

Does STomp work in Firefox and Safari?

STomp is built and tested against Chrome; the CI suites run in Chrome. The documented differences in other engines: WebKit has no credentialless (use require-corp), URLPattern-based request rules are skipped where the browser has no URLPattern, and canGoBack and canGoForward are null without the Navigation API, so a host cannot tell whether to enable Back and Forward there.

Can I host STomp on a static host?

The files of dist/ and the transport are static and need no server code, so yes for the files, with the public relay for wisp. What you lose depends on the host's header control: without COOP and COEP no proxied page is cross-origin isolated, without Cache-Control rules the host's defaults decide how long serviceWorker.js and the rest are kept, and without a way to send frame-ancestors you have to edit stomp-allowed-origins in controllerFrame.html yourself. Two subdomains of a shared hosting domain on the public suffix list (such as github.io) are two sites to the browser, so isolation mode there hits StorageBlockedError in browsers that block third-party cookies. Use your own domain for both origins.

Why is the first visit slow?

The download is about 2.7 MB brotli, most of it the epoxy transport and its HTTP/3 stack, and the content blocker fetches its filter lists through the transport on a fresh profile. Repeat visits are faster when the ?<hash> files are cached immutable (Caching). adblock: false skips the lists; bench/RESULTS.md has the numbers.

Do two tabs of my host share cookies and logins?

Yes. The cookie jar, the HTTP cache and the storage partitions belong to the directory, and every controller of that directory shares them. Each tab runs its own controller with its own id. controller.cookies reads and writes the jar from the host side.

How do I update STomp?

Install the new exact version (npm install --save-exact @sysce/stomp@<version>), deploy its dist/ and the transport together, and keep directory and codec as they were. Open tabs keep working and report stale until they reload (Rolling out an update).

Clone this wiki locally