Skip to content
ErrorDock

JavaScript SDK

Capture browser errors with source map support, breadcrumbs, session context and opt-in tracing.

Release candidate: @errordock/core and @errordock/browser are published on npm at 0.1.0-rc.2. Pin that version when you install, because npm's latest tag still points at the older rc.1.

The JavaScript SDK captures uncaught exceptions, unhandled promise rejections and page views in browser applications automatically. It accepts only browser keys (ed_pub_), and a browser key works only from the exact origins you allow for it.

Install

npm install @errordock/core@0.1.0-rc.2 @errordock/browser@0.1.0-rc.2

Configure

import { init, addBreadcrumb } from "@errordock/browser";

init({
  apiKey: "ed_pub_...",
  endpoint: "https://api.errordock.com",
  environment: "production",
  release: "2.8.4",
});

Source maps

A production stack trace pointing at main.a83f2.js:1:284100 is not actionable. Upload each source map for the release it belongs to, and frames resolve to original file, line and column:

curl -X POST "https://api.errordock.com/v1/artifacts?release=2.8.4&name=main.a83f2.js.map" \
  -H "Authorization: Bearer $ERRORDOCK_KEY" \
  --data-binary @dist/main.a83f2.js.map

The key is a server key (ed_live_) with the artifacts:write scope, so run the upload from your build or CI, never from the browser. Maps can be up to 60 MB. Source maps should be uploaded, not deployed: serving them publicly publishes your source.

During the beta, source-map upload is enabled per organisation. Ask us to switch it on.

Navigation, fetch and XHR calls, console output and user interactions are recorded automatically. Add your own for domain events:

addBreadcrumb({ category: "checkout", message: "Coupon applied" });

Tracing

Tracing is opt-in. Switch it on in init, and wrap your own work in withSpan or startSpan:

import { init, traceHeaders } from "@errordock/browser";

init({
  apiKey: "ed_pub_...",
  endpoint: "https://api.errordock.com",
  environment: "production",
  release: "2.8.4",
  tracing: true,
});

const response = await fetch("/api/cart", {
  headers: { ...traceHeaders() },
});

Trace headers are not injected for you: add traceHeaders() to the fetch calls you want to follow. When the server runs OpenTelemetry and exports to ErrorDock, its spans join the browser trace.

Features and users

trackFeature(name, props) records that a feature was used. withFeature(name, fn) runs fn and records the outcome as well, which gives the feature its error rate. trackInteraction records an explicit interaction, setUser sets your own user id, and flush sends anything still queued.

The JavaScript SDKs do not carry a feature-flag client. Flag evaluation is in the .NET SDK only.

Last updated October 20, 2026