Skip to content

When something breaks

Report errors from your frontend

Kiyesi’s browser snippet reports errors and failed requests from your users’ browsers. Kiyesi groups them, tells you how many people they hit, and, once your build uploads its source maps, shows the real file and line.

In the dashboard, open Settings, Frontends. Give the frontend a name, such as storefront-web, choose its project and environment, and list the sites allowed to report: the addresses your pages are served from, such as https://shop.example.com, one a line. Only those sites can report with its key, so nobody can fill your errors from elsewhere. Use http://localhost:3000 for a local copy.

You need Manage on browser errors: the Owner or Admin role, or a role you made with it.

Copy the snippet Kiyesi shows into the <head> of every page:

<script src="https://cdn.kiyesi.dev/v1/browser.js"
data-key="ksk_…" data-version="2.14.0" async></script>

Set data-version to your app’s version when you build, such as your package version or a commit. The key is public by design: it is in every page, and only works from your sites.

/v1/browser.js gets fixes without you changing anything. To load only code you have checked, pin a version instead. Each pinned copy never changes, and the browser refuses it if a single byte differs from the hash:

<script src="https://cdn.kiyesi.dev/pinned/1.1.0/browser.js"
integrity="sha384-HTbd7052qUilcRYTEQR29NU+EFNKiF+ZINwNlkBVvGV9K6Q8tGUnXB7pbGW6/q2j"
crossorigin="anonymous" data-key="ksk_…" data-version="2.14.0" async></script>

You then take fixes by changing the version and hash yourself. The code of each version is public at github.com/Kiyesi/agent, under snippet/.

Turn on source maps in your build (build.sourcemap: true in Vite, productionBrowserSourceMaps: true in Next.js, devtool: "source-map" in webpack). Then, after building, in your build step:

Terminal window
kiyesi sourcemaps upload --version 2.14.0 --delete ./dist

Use the same version as data-version. In CI, set KIYESI_DEPLOY_TOKEN to a deploy token from Settings, Deploy tokens. Add --frontend storefront-web when your team has more than one frontend. The maps stay in the folder: Kiyesi never deletes a file. --delete prints the rm command that removes the uploaded ones, so you can run it before you publish your site.

Errors that arrived before the maps are read again within a minute.

Open Browser errors in the dashboard:

  • Errors in the last 24 hours, how many groups they fall into, and which frontends reported.
  • Each group: the error, where in the code, how many times and how many people in the time you choose, and when it was first seen, with its version. When people were not counted for an error, it says Not counted rather than 0.
  • Choose a group to see where it broke (its stack, read through the source map), which versions it happens on and by browser since it was first seen, how many people it reached in the last 30 days, and the latest examples with their page and request ID.

Errors with the same type, message and place are one group, even across builds, so a thousand of the same error are one row.

Each group seen in the last 24 hours is a piece of Assigned work: the selected error shows its owner, with Assign or Reassign. Kiyesi suggests whoever works on the frontend.

Terminal window
kiyesi errors
kiyesi errors --frontend storefront-web --since 7d

The snippet adds an X-Request-Id header to your site’s own requests, and reports a failed or slow request with its ID. If your web server writes that header to its log, you can follow the request through your backend: see Follow a request.

It only adds the header to requests to the page’s own site. To add it to your API on another address, list it, after making sure that API allows the X-Request-Id header from your pages (its CORS settings):

<script src="https://cdn.kiyesi.dev/v1/browser.js" data-key="ksk_…" data-version="2.14.0"
data-trace-origins="https://api.example.com" async></script>

Sent with each error: the error’s type, message and stack; the page address without its query or fragment; the app version; and, for a failed request, its method, path and request ID. The service names the browser (such as Chrome on Android) and does not keep the browser’s own string or the visitor’s address.

Never collected: what people type, cookies, storage, page content, screen recordings, or addresses’ query parts. Email addresses, passwords and tokens in messages and request paths are masked in the browser, before anything is sent, and again by the service.

Counting people: each visitor is counted with a hash salted afresh each day, kept as a fixed-size count (a HyperLogLog). Nobody can be recognised from one day to the next, and nothing is kept beyond 31 days.

Sent for a slow request to your own site (one that took a second or more): its method, its path without the query, the status code it got back, how long it took, and its request ID. See Follow a request.

Its manners: it sends each error once per page and at most ten error reports and twenty slow requests a page, sends without waiting for an answer, never slows your page, and never throws an error of its own. It is under 3 KB compressed.

  • Errors are kept 30 days after they last happened.
  • One visitor can send at most 30 reports a minute. Each frontend has its own daily allowance, and one visitor’s address may use at most 2,000 reports of it a day, so one visitor cannot use up the rest. Once either daily limit is reached, reports are accepted but not kept.
  • When Kiyesi is very busy, reports are turned away for a minute rather than kept waiting.
  • Each error counts up to 50 versions of your app by name; any more are counted together as other.
  • Errors open an incident, and page whoever is on call, only when a frontend sends 25 or more in 5 minutes and at least three different visitors reported them. One visitor alone, or a script, never pages anyone.
  • Source maps: up to 20 MB each, the last 10 versions per frontend.
  • Nothing arrives. Check the page’s address is one of the frontend’s sites allowed to report, exactly, including https:// and any www.. Errors thrown from the browser’s console are reported too, but have no file in your code.
  • “no source map yet”. Upload the maps for the same version the snippet reports, then wait a minute. Check the build made .map files.
  • A request ID causes errors on your API. Your API does not allow the X-Request-Id header from your pages: allow it, or remove that address from data-trace-origins.