Honeybadger for JavaScript
Universal JavaScript error notifier that reports uncaught exceptions from the browser, Node.js, and AWS Lambda to Honeybadger.io.
Repository Health
Technical Analysis
@honeybadger-io/js is the official isomorphic JavaScript SDK for the Honeybadger.io error-monitoring service. A single package ships both a browser build and a Node.js/serverless build, automatically capturing uncaught exceptions, unhandled promise rejections, and console breadcrumbs, then reporting them to Honeybadger with source-mapped backtraces, request context, and user metadata.
Beyond automatic error capture, it exposes an ergonomic API for manual notification, context enrichment, before/after-notify handlers, breadcrumbs, Express/Connect middleware, an AWS Lambda handler, cron/uptime check-ins, and an in-app user feedback form. The browser and server clients share a common core so configuration and behavior stay consistent across every JavaScript runtime.
What You Get
- A single isomorphic package with separate optimized browser and Node.js/serverless builds selected automatically via package.json main/browser fields
- Automatic capture of uncaught exceptions, unhandled promise rejections, and breadcrumbs (console, DOM events, timers, network) with no manual wiring
- An ergonomic client API: Honeybadger.configure(), notify(), setContext(), beforeNotify()/afterNotify() handlers, and addBreadcrumb()
- Framework and platform integrations: Express/Connect error and request middleware, an AWS Lambda handler, and Cloudflare Workers support
- Cron and uptime check-in reporting plus an embeddable in-app user feedback form
- First-class TypeScript type declarations shipped with the package
Common Use Cases
- Reporting client-side browser errors from a single-page application with source-mapped stack traces
- Monitoring uncaught exceptions and unhandled rejections in a Node.js or Express backend service
- Capturing failures in AWS Lambda functions via the provided serverless handler
- Adding rich context (user, request, custom tags) to error notices before they are sent to Honeybadger
Under The Hood
Architecture — The package is isomorphic: src/browser.ts and src/server.ts each define a Honeybadger class extending the shared abstract Client from the sibling @honeybadger-io/core package (packages/core/src/client.ts, ~500 lines), which owns notice construction, before/after-notify handler pipelines, breadcrumbs, context merging, and event throttling. Rollup produces three artifacts (server build, browser build, minified browser build), and package.json main/browser fields plus a hand-authored combined honeybadger.d.ts route consumers to the right build. Browser integrations (onerror, onunhandledrejection, breadcrumbs, timers, event listeners) and server integrations (uncaught-exception, unhandled-rejection, and shutdown plugins, Express middleware, AWS Lambda handler, and a check-ins manager) live under src/browser/ and src/server/ respectively, each pulling in a runtime-specific transport.
Tech Stack — Written in TypeScript (targeting Node >=14), bundled with Rollup and terser, and depending at runtime on @honeybadger-io/core plus AWS Lambda and Express type packages. The monorepo is managed with Lerna in independent-versioning mode and enforces Conventional Commits via husky + commitlint. Sibling packages provide framework wrappers (React, Vue, Next.js, Gatsby, React Native) and source-map upload plugins (Webpack, Rollup/Vite, esbuild).
Code Quality — Testing is thorough: 24 Jest unit-test files split across browser (jsdom) and server (node) environments, tsd type-definition tests under test-d/, and Playwright end-to-end integration tests run against real browsers via BrowserStack. Code is strictly typed, integrations are cleanly separated into small single-responsibility modules, and the shared-core design keeps browser and server behavior consistent.
API Design — The public surface is a configured singleton: Honeybadger.configure({ apiKey }) then notify(), setContext(), beforeNotify()/afterNotify(), and addBreadcrumb(). Platform helpers (errorHandler, requestHandler, lambdaHandler, checkInsApi) are exposed as properties on the server client, so most apps need only a few lines to start reporting. Shipped TypeScript declarations and an extensive documentation site keep the developer experience low-friction.
Used by 2 apps in this directory
Forem
Community · Blogging
Open source Ruby on Rails platform for building developer communities with articles, discussions, and social profiles—the same software that powers dev.to.
RSSHub
Automation · Social Media
Turn any website into an RSS feed — social media, streaming platforms, and niche sites all become subscribable in seconds.