Engineering Diaries · Frontend Observability
§
Frontend ObservabilityRelease EngineeringJavaScript

The Failure Your Frontend Monitoring Cannot See

Frontend observability tools start after your application bundle executes. That leaves a dangerous blind spot: the failures that prevent the monitoring SDK itself from loading. Here is the small browser beacon and release-context design that closes it without turning error reporting into another outage.

01 · THE EMPTY DASHBOARD

A green dashboard does not prove that the frontend worked

A release goes out. The error dashboard stays quiet. Real-user monitoring shows almost no new exceptions. The deploy is declared safe.

Then support says a slice of users sees a blank page.

This is not a contradiction. It is a boundary problem. Most frontend telemetry starts inside the JavaScript application: the monitoring SDK is imported, configured, and then begins collecting exceptions, route changes, performance data, and breadcrumbs. If the browser cannot download, parse, or execute the bundle containing that SDK, the SDK has no opportunity to describe its own absence.

I used to read a quiet error dashboard as an absence of errors. It is only evidence about the code that successfully reached the instrumentation point. A failed script request, an old HTML document pointing at a removed hashed chunk, a content blocker rule, or a syntax error before initialisation can all leave the main application unusable and the normal observability stack perfectly calm.

Telemetry is not outside the system. It is another dependency inside it.

The useful question is not “do we have an error tracker?” It is “which failures can occur before the tracker is alive, and what independent signal would reveal them?” That question changes both the implementation and the release conversation.

02 · THE BOOT SEQUENCE

Map the point where visibility begins

Every single-page application has a small sequence before a user can interact with it. The browser receives HTML. It discovers CSS and JavaScript. It fetches scripts. The JavaScript engine parses and evaluates an entry module. Framework code mounts. Only then does the usual monitoring setup run.

The exact order differs by framework, but the observability boundary is usually later than teams assume. Put an SDK at the top of main.tsx and it is still downstream of the entry chunk arriving, the module graph resolving, and the runtime being compatible with the browser.

Failure classes before SDK initialisation

Entry or chunk requests that return 404 or a stale asset; parse and evaluation failures in the first module; extension and network interference; unsupported syntax; and an HTML-to-asset version mismatch after a deploy.

Do not lump all of these together as “white screen”. They have different owners and remedies. A 404 after an asset cleanup suggests release coordination. A parse failure suggests a build target or dependency change. Blocked requests may need a different hostname or graceful fallback. The first job is to preserve enough raw context to tell those paths apart.

This also explains why a client-side window.onerror handler is helpful but incomplete. It can report an exception once the browser evaluates the inline code that registered it. It cannot help if the document never reaches that code, and cross-origin script errors can be deliberately opaque without the right response headers.

03 · A SMALLER SENTINEL

Put a tiny beacon before the application, not inside it

The practical pattern is deliberately boring: an inline, dependency-free sentinel in the HTML document, before the application entry script. It listens for resource failures and sends a small event to a backend endpoint using an API designed to survive navigation.

document shell
<script>\nwindow.addEventListener('error', function (event) {\n  var target = event.target;\n  if (!target || !target.src) return;\n  if (target.tagName !== 'SCRIPT') return;\n\n  var body = JSON.stringify({\n    type: 'script-load-failed',\n    src: target.src,\n    release: window.__RELEASE_ID__,\n    path: location.pathname,\n    at: Date.now()\n  });\n\n  navigator.sendBeacon('/frontend-boot-failures', body);\n}, true);\n</script>\n<script type="module" src="/assets/app.abc123.js"></script>

The capture phase matters. Resource-load errors do not bubble in the same way as ordinary JavaScript errors, so the listener must be registered high enough to see them. The script is intentionally old-fashioned: no imports, no app utilities, no async wrapper, no dependency on a hydrated framework tree.

This is not a second analytics product. It is a smoke detector. Keep the payload narrow, avoid user content, and accept that it may be sampled. A handful of well-labelled failures per release is more useful than a high-volume event stream nobody can investigate.

04 · RELEASE CONTEXT

Without a release identifier, a beacon is only a complaint

A report that says “a script failed” becomes actionable only when it answers three questions: which document did the user receive, which asset was requested, and which release produced both.

Inject a release identifier into the HTML at build or deploy time. It can be a commit SHA, a build number, or a short immutable release token. Include it in the beacon alongside the page path and the failed resource URL. The backend should record receipt time separately from the browser timestamp, because client clocks are not a source of truth.

Useful correlation keyRecord the document release, requested asset URL, route, browser family, and server receipt time. That is enough to join a failure cluster to a deployment without collecting a user identity.

Hash-named assets make this especially valuable. If users receive index.html from release A but the CDN no longer serves A’s chunks, the URL itself often reveals the mismatch. The release token tells you whether the HTML was stale, the asset was prematurely removed, or the user is requesting a version you did not expect to exist.

Do not put secrets, raw query strings, or full user-agent blobs into this endpoint by default. Observability data has a habit of becoming long-lived. Define the small schema you need, then make new fields earn their way in.

05 · THE INGESTION PATH

Your fallback needs a fallback of its own

A boot-failure endpoint is easy to make noisy and surprisingly easy to make fragile. It should not require the application session to be valid, should not redirect, and should not run expensive work inline. Treat it as a write-only intake with tight validation and a short response.

Use an allowlist for event types. Validate that resource URLs match hosts you own. Bound string lengths. Rate-limit by a coarse key such as release and resource path, not an identifier that turns a reliability feature into tracking infrastructure. If you need richer processing, queue it after the request is accepted.

It is also worth deciding what success looks like. A normal release should have a near-zero baseline, but not necessarily literal zero: mobile networks terminate requests, browser extensions interfere, and users can hold old documents open for a long time. Alert on a sudden cluster associated with a new release or a specific asset, not on every isolated event.

SignalLikely readingFirst response
Many routes, one new entry assetBad bundle or CDN deliveryPause or roll back release
One old hashed assetStale HTML or cache mismatchCheck retention and cache rules
One browser familyCompatibility regressionInspect build target and syntax
Low-volume mixed assetsNetwork or extension noiseMonitor before escalating
06 · WHAT NOT TO PROMISE

This pattern narrows a blind spot. It does not eliminate one

The sentinel depends on the document being delivered and its own inline code being allowed to run. A restrictive content security policy can block it if you do not use a nonce or hash. A fully offline browser may not send the beacon. A malicious extension can still modify the page. None of that is a reason to skip the design; it is a reason to describe the boundary honestly.

Be careful with automated reload logic too. Seeing a failed chunk and immediately refreshing can make a temporary CDN issue look like a traffic spike, while hiding the failure pattern you need to diagnose. If you offer recovery, cap retries, add jitter, and preserve the original failure event before attempting a reload.

Do not turn boot reporting into surveillance

There is no need for names, email addresses, typed form data, or a durable device fingerprint to diagnose a failed script. A release-scoped operational signal is enough.

The same restraint applies to dashboards. The point is not a prettier red chart. The point is a route from “we cannot see this class of failure” to a concrete release, asset, and owner who can act.

07 · HOW TO TEST IT

Test the missing bundle path before production does

A monitoring design that only exists in a diagram will fail at the interesting moment. Add an integration check that serves a document whose entry script returns 404 and asserts that the intake endpoint receives exactly one validated event. Repeat with a deliberately invalid first module if your test environment can safely serve one.

playwright-style check
await page.route('**/assets/app.abc123.js', route =>\n  route.fulfill({ status: 404, body: 'missing' })\n);\n\nawait page.goto('/');\n\nawait expect.poll(async () => intake.events()).toContainEqual(\n  expect.objectContaining({\n    type: 'script-load-failed',\n    release: 'test-release'\n  })\n);

Run this whenever the document shell, CSP, asset host, or release pipeline changes. Those are the changes most likely to move the sentinel behind the boundary it is meant to observe.

Finally, rehearse the human side. When the alert fires, who checks the CDN? Who compares deployed HTML to available assets? Who can pause a rollout? A signal without an owner is just another item in an observability backlog.

08 · THE VERDICT

Measure the moment before your app exists

Frontend monitoring is strongest when it tells the truth about where it begins. Your regular SDKs remain essential: they explain exceptions, slow interactions, route transitions, and user journeys after the application comes alive. But they should not be the only witness to a deployment.

Start by drawing the boot sequence for one production page. Mark the first line of code that can emit normal telemetry. Everything before that line is a candidate blind spot. Then add the smallest independent signal that can survive there: an inline resource-error listener, a release identifier, and a constrained ingestion endpoint.

If an error tracker is loaded by the thing that failed, the dashboard may be silent precisely when you need it most.

This is not glamorous infrastructure. It is a few lines of defensive code around the border of a system. In reliability work, those borders are where the expensive surprises tend to live.

Written by Divyansh Singh. Views expressed are the author's own. Published November 2026. All code examples have been tested and verified.