Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@honeybadger-io/react

honeybadger-io100.6kMIT6.1.27TypeScript support: included

React.js integration for honeybadger

readme

Honeybadger React.js Integration

Node CI npm version npm dm npm dt

React.js Integration for Honeybadger.io

Documentation and Support

For comprehensive documentation and support, check out our documentation site.

The documentation includes a detailed React integration guide

Project Goals

The goal is to provide an idiomatic, simple integration of Honeybadger's exception monitoring service with React.js applications.

Project Status

This version is considered suitable for preview.

Limitations

Honeybadger-react hooks in to the error handler in React. This means we only notify Honeybadger of React context for errors that React handles. Some errors inside React code may propagate to the window onerror handler instead.

In those cases, Honeybadger JavaScript's default error notifier is invoked, which will contain a stack trace but none of the React variables.

Key Assumptions

This project is built using create-react-library with rollup and generates artifacts in commonjs, esm and umd formats. It's possible your own build environment may be just different enough to require some adjustments. If you find that our artifacts don't quite meet your needs, please file an issue on GitHub.

Example apps

There are minimal implementations of a honeybadger-react integration in the ./examples folder. If you want to contribute a patch to @honeybadger-io/react, it can be useful to have the demo apps running.

To run the example app using React v19, issue these commands from your shell:

cd examples/react-19
npm install
REACT_APP_HONEYBADGER_API_KEY=b425b636 npm run start

This will start the demo app with hot reload enabled.

Development

# install dependencies
npm install

# build for production
npm run build

# run unit tests
npm test

# automatically continuously rebuild the dist/ artifacts with hot reload when developing
npm run start

License

This package is MIT licensed. See the MIT-LICENSE file in this folder for details.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

5.5.0 (2023-05-11)

Features

  • rollup-plugin: rely on the sourcemap and js files being in the same folder and named the same (#1063) (0ea16b6)

5.4.1 (2023-05-08)

Bug Fixes

  • rollup-plugin: document rollup peer dependency (#1061) (d64a681)

5.4.0 (2023-04-27)

Features

5.3.2 (2023-04-14)

Bug Fixes

  • nextjs: move notify logic in _error.js (0179ec4)

5.3.1 (2023-04-14)

Bug Fixes

  • nextjs: copy _error.js component (2fa5c7d)

5.3.0 (2023-04-14)

Features

5.2.0 (2023-03-27)

Features

  • core: accept a backtrace passed in the notice (#1049) (9c56a9f)

5.1.7 (2023-03-20)

Note: Version bump only for package root

5.1.6 (2023-03-14)

Note: Version bump only for package root

5.1.5 (2023-03-06)

Note: Version bump only for package root

5.1.4 (2023-02-27)

Note: Version bump only for package root

5.1.3 (2023-02-17)

Bug Fixes

  • react: import correctly @honeybadger-io/js (#1024) (10b4a5f)

5.1.2 (2023-02-14)

Bug Fixes

5.1.1 (2023-02-13)

Note: Version bump only for package root

5.1.0 (2023-02-08)

Features

  • rollup: add deployment notification to Rollup plugin (2b3abf3), closes #1012

5.0.0 (2023-02-05)

⚠ BREAKING CHANGES

  • minimum supported nodejs at v14.x
  • changes default revision from master to main (#951)
  • update to lerna 6 (#918)

Features

  • changes default revision from master to main (#951) (33a8a46)
  • rollup / vite plugin (9246ed7)

Build System

4.9.3 (2023-01-20)

Bug Fixes

  • vue3: constructor was accessed during render warning in (40568c9), closes #996

4.9.2 (2023-01-18)

Bug Fixes

  • replace instrument with safer alternative addEventListener (#1002) (8569f09)

4.9.1 (2023-01-14)

Bug Fixes

  • improve generateStackTrace function to hide vue warn message (#1000) (45c6ad6)

4.9.0 (2023-01-14)

Features

4.8.2 (2023-01-02)

Note: Version bump only for package root

4.8.1 (2022-12-22)

Bug Fixes

  • filter out honeybadger source code from stack trace (#982) (e647b75)

4.8.0 (2022-12-12)

Features

  • add window / document checks, refactor XMLHttpRequest to Fetch (#958) (b7e717f)

4.7.5 (2022-12-05)

Note: Version bump only for package root

4.7.4 (2022-11-26)

Bug Fixes

4.7.3 (2022-11-22)

Bug Fixes

4.7.2 (2022-11-21)

Note: Version bump only for package root

4.7.1 (2022-11-14)

Note: Version bump only for package root

4.7.0 (2022-11-01)

Bug Fixes

  • require correct honeybadger js package (#919) (9ab2288)

Features

  • migrate honeybadger-react-native to monorepo (#901) (46f3d7e)

4.6.2 (2022-10-28)

Bug Fixes

4.6.1 (2022-10-24)

Bug Fixes

  • README.md misleading dev to use wrong import code on while working with ES6 Import. (#916) (246633a)

4.6.0 (2022-10-17)

Features

4.5.0 (2022-10-04)

Features

4.4.1 (2022-10-03)

Note: Version bump only for package root

4.4.0 (2022-09-28)

Features

  • migrate honeybadger-react to monorepo (#892) (e026b76)

4.3.1 (2022-09-26)

Bug Fixes

4.3.0 (2022-09-17)

Bug Fixes

  • handle sync lambda handlers (non callback-based) (#887) (be5c2fd), closes #860

Features

4.2.1 (2022-09-16)

Bug Fixes

  • release correct version, lerna import did not work (#883) (cbe73ac)

4.2.0 (2022-09-13)

Features

  • migrate honeybadger-webpack to monorepo (#869) (0c31c1a)
  • workflow for automatic (scheduled) releases (#867) (1f01d94), closes #861

4.1.3 (2022-09-04)

Bug Fixes

  • revert to es5 transpilation (#866) (97bd2e7), closes #863
  • update package-lock.json to include @types/aws-lambda (85748bb)

4.1.2 (2022-09-01)

Bug Fixes

4.1.1 (2022-08-20)

Bug Fixes

  • improve type definition for GlobalStore (#862) (6f722fe)

4.1.0 (2022-08-12)

Bug Fixes

Features

  • monorepo: setup monorepo skeleton and break js to 2 packages (#844) (2fbdc56), closes #854
  • support nested exceptions (Error.prototype.cause) (ac958ee)
  • unwind nested error causes (551fcee)

4.0.5 (2022-07-26)

Bug Fixes

  • refactor http.request for libraries that may patch it (8007395), closes #843

4.0.4 (2022-07-19)

Bug Fixes

4.0.3 (2022-05-17)

Bug Fixes

  • make sure file is bundled with rollup (#793) (fbcfea6)

4.0.2 (2022-05-16)

Bug Fixes

  • cleanup CHANGELOG.md file to use with conventional-changelog (#786) (05b8b76), closes #778
  • improve typings (#788) (2552a5f)
  • make sure shipjs workflows do not modify package-lock.json (#787) (b1568ff)

[4.0.1] - 2022-05-06

Fixed

  • Typescript typings for optional dependencies

[4.0.0] - 2022-05-04

Added

  • AWS Lambda Timeout Warning (#679)
  • Enforce Conventional Commits using a git hook (#731)
  • Nodejs: Include source snippet in backtraces when available (#624)
  • notifyAsync: Async version of notify that returns a promise (#327)
  • AsyncLocalStorage for AWS Lambda Handler (#688)
  • Node.js: Added the hb.withRequest(req, fn) method for webserver apps, which runs a fn, isolating its context to the request req and tracking it across async chains. The Honeybadger.requestMiddleware for Express is now a wrapper around this. (#711, #717)
  • Honeybadger.checkIn() (#725)

Fixed

  • Respect object.toJSON() in breadcrumb.metadata (#722)
  • Allow special characters in tags. Also support space-delimited tags: "one two three" and "one, two, three" are equivalent
  • Include reported error link in logs (#713)
  • Properly handle objects which are not native Errors but have the Error prototype (#712)

Changed

  • Call afterNotify handlers with error if notify preconditions fail (#654)
  • Call beforeNotify handlers even if preconditions fail (#654)
  • Honeybadger.lambdaHandler: return async or callback based handler based on input handler (#677)
  • Remove deprecated disabled config option (#671)
  • Apply enableUncaught setting to timers and event listeners (#690)
  • Name wrapped Lambda handlers for better stack traces (#700)

[3.2.8] - 2022-02-15

Fixed

  • Catch unknown errors in data sanitizer

[3.2.7] - 2021-11-01

Fixed

  • Call lambda handler callback with result if user-defined handler is async (#648)

[3.2.6] - 2021-10-26

Fixed

  • Call lambda handler callback if notify preconditions fail (#648)

[3.2.5] - 2021-09-22

Fixed

  • Check for api key only if enabled (#637)

[3.2.4] - 2021-08-31

Fixed

  • Add details option to notice (#629)

[3.2.3] - 2021-08-11

Fixed

  • TypeScript: Make exported type definition work as type or value (#621)

[3.2.2] - 2021-07-19

Fixed

  • TypeScript: Add missing methods typedefs (#611)
  • Internal: Fixed TypeScript types, added null checks, automated type declaration files

[3.2.1] - 2021-05-17

Fixed

  • TypeScript: Use express types for middleware (#564)

[3.2.0] - 2021-03-30

Fixed

  • Update Node API endpoint to enable source map processing for server-side errors.

Added

  • Add tagging to errors with 3 possible API's
      Honeybadger.configure({tags: string | string[] | undefined})
      Honeybadger.setContext({tags: string | string[] | undefined})
      Honeybadger.notify('error', {tags: string | string[] | undefined})

[3.1.0] - 2021-03-04

Fixed

  • Add default reason for unhandled promises (previously reason was "undefined") (#546)

Added

  • Add Honeybadger.clear() method to clear context and breadcrumbs
  • Deprecate Honeybadger.resetContext()

[3.0.4] - 2021-03-01

Fixed

  • Add server middleware signatures to type declarations (#540, @getabetterpic)

[3.0.3] - 2021-02-02

Fixed

  • types: Make sure every breadcrumb prop is optional (#527, @paambaati)

[3.0.2] - 2021-01-28

Fixed

  • utf8 encode JSON payload in Node

[3.0.1] - 2021-01-20

Fixed

  • Adjust backtrace display and logging in Node
  • Fix a bug in Node lambdaHandler

[3.0.0] - 2021-01-19

Added