Skip to content

Browser errors

Since v0.7.0, the SDK can also report the JavaScript errors of your pages, whether they are built with Blade, Livewire and Alpine, or with Inertia. A browser error lands in the same issues as your PHP exceptions, with the same alerts, the same quota and the same encryption. The class reads JavaScript\TypeError, JavaScript\ReferenceError and so on.

Turn it on for the project

In the dashboard, open the project's Settings, then the Browser errors section:

  1. Turn on Capture browser errors.
  2. List the allowed origins, one per site your pages are served from, written https://app.example.com (with the port when it is not the default one). The origin of the project's uptime URL is offered.
  3. Save. A browser key appears, with the lines to copy.

The browser key is public: it ends up in the source of your pages, which is unavoidable for a script running in a visitor's browser. It is not MONITOR_KEY, which is a secret and must never reach a page. What protects the endpoint is the origin list: a report whose Origin header is not one of those you listed is refused. Change the key replaces it at once; the old one stops working.

Install the script

Add the key to the application's .env:

MONITOR_BROWSER_KEY=your-public-browser-key

Then the directive to the <head> of your layout, before your own scripts so it sees their errors:

<head>
    @quietGuardBrowser
    @vite(['resources/css/app.css', 'resources/js/app.js'])
</head>

The directive prints a small script inline, with no dependency: no npm package to install and no asset to publish. It prints nothing without MONITOR_BROWSER_KEY, and nothing when exceptions would not be reported either (MONITOR_ENABLED=false, or an environment left out of MONITOR_ENVIRONMENTS). The release and the environment are those of your PHP reports, so the two land on the same deploy.

Content-Security-Policy

If your site sends a Content-Security-Policy:

  • the script carries the nonce Vite gives the page (Vite::useCspNonce()), so a script-src with a nonce accepts it;
  • connect-src must allow the Quiet Guard server's origin, https://quietguard.dev for the hosted service (your own address when you host it).

What is captured

The script listens to uncaught errors (error) and unhandled promise rejections (unhandledrejection). Each report carries:

FieldContent
Errorits name, its message and its stack
Pagethe address of the page, without its query string or fragment
Browserthe user agent
Livewirewhether Livewire is on the page
Alpinethe expression that failed, when Alpine raised the error
Release, environmentthose the SDK sends with your exceptions

No cookie is read or set, and no identifier follows a visitor. The server keeps no IP address: it is only used, hashed, to rate-limit. It masks the personal values (an email, a card number, an IBAN, a phone number) and the credentials it finds in the message, the stack and the address, since a browser runs no masking of its own.

At most ten reports leave a page load, and the same error once.

What is ignored

  • "Script error.", the opaque message a browser gives for an error raised by a script from another origin without crossorigin: it carries nothing to act on. Neither stored nor counted.
  • The frames of a browser extension (chrome-extension://, moz-extension://, safari-web-extension://), and an error whose frames all belong to one.

What the origin list protects, and what it does not

The origin check stops other websites from posting reports through your visitors' browsers: a browser always sends the true Origin of the page it runs. It does not stop a forged request. The key is in your pages' source, and anyone can send a request with any Origin header from a script or a terminal. So the endpoint is built to contain a forger rather than to keep one out:

  • Rate limits: 30 reports a minute from one address whatever the key, 10 a minute per key from one address, and 120 a minute per project once the origin is checked.
  • A daily cap: a team stores at most a quarter of its monthly exception quota spread over thirty days, all its projects together (416 a day on a plan of 50,000 exceptions, 41 on Free), counted before the quota. Reports past it are acknowledged and not stored: a forger who reaches it can blind your browser reports for the rest of the day, never more than a quarter of the quota your server-side exceptions rely on.
  • Key rotation: Change the key in the project's settings makes the old key answer 404 at once.
  • Alert throttling: the channel budget that holds back an alert storm applies to browser issues as to any other.
  • No GitHub issue opened by itself: a browser error never opens a GitHub issue automatically, even when the project creates them for new issues. A member can still open one by hand from the issue page.

Limits

  • No source maps. Frames show the built bundle (app-AbC123de.js:1:2345), with the line and the column. The same error is grouped across deploys, whatever the build hash and the column.
  • Each report counts as one exception of your monthly exception quota.
  • The endpoint accepts at most 30 reports a minute from one address, 10 a minute per key from one address, and 120 a minute per project.

You are reading the Laravel SDK v1.0 documentation.