Package detail

@honeybadger-io/webpack

honeybadger-io83kMIT6.3.1

Webpack plugin to upload source maps to Honeybadger's API - http://docs.honeybadger.io/guides/source-maps.html

webpack, sourcemap, source map, minified js

readme

Honeybadger's Webpack Source Map Plugin

Node CI npm version npm dm npm dt

Webpack plugin to upload JavaScript source maps to Honeybadger. You can also send deployment notifications.

Word Up! to the thredUP development team for a similar webpack plugin they have authored.

Installation

# npm
npm install @honeybadger-io/webpack --save-dev

# yarn
yarn add @honeybadger-io/webpack --dev

Configuration

Plugin parameters

These plugin parameters correspond to the Honeybadger Source Map Upload API and Deployments API.

apiKey (required)
The API key of your Honeybadger project
assetsUrl (required)
The base URL to production assets (scheme://host/path)*wildcards are supported. The plugin combines assetsUrl with the generated minified js file name to build the API parameter minified_url
endpoint (optional — default: "https://api.honeybadger.io/v1/source_maps")
Where to upload your source maps to. Perhaps you have a self hosted source map server you would like to upload your source maps to instead of honeybadger. If you are using our EU stack, this should be set to "https://eu-api.honeybadger.io/v1/source_maps".
revision (optional — default: "main")
The deploy revision (i.e. commit hash) that your source map applies to. This could also be a code version. For best results, set it to something unique every time your code changes. See the Honeybadger docs for examples.
silent (optional — default: "null/false")
If true, silence log information emitted by the plugin.
ignoreErrors (optional — default: false)
If true, webpack compilation errors are treated as warnings.
retries (optional — default: 3, max: 10)
This package implements fetch retry functionality via https://github.com/vercel/fetch-retry
Retrying helps fix issues like ECONNRESET and SOCKETTIMEOUT errors and retries on 429 and 500 errors as well.
workerCount (optional — default: 5, min: 1)
Source maps are uploaded in parallel by a configurable number of workers. Increase or decrease this value to configure how many source maps are being uploaded in parallel.
Limited parallelism helps with connection issues in Docker environments.
deployEndpoint (optional — default: "https://api.honeybadger.io/v1/deploys")
Where to send deployment notifications. If you are using our EU stack, this should be set to "https://eu-api.honeybadger.io/v1/deploys".
deploy (optional — default: false)
Configuration for deployment notifications. To disable deployment notifications, ignore this option. To enable deployment notifications, set this to true, or to an object containing any of these fields (see the API reference):
environment
The environment name, for example, "production"
repository
The base URL of the VCS repository (HTTPS-style), for example, "https://github.com/yourusername/yourrepo"
localUsername
The name of the user that triggered this deploy, for example, "Jane"
developmentEnvironments (optional — default: ["dev", "development", "test"])
Source maps upload will be skipped when the environment matches any of the values in this array or the webpack dev server is running.

Vanilla webpack.config.js

const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack')
const ASSETS_URL = 'https://cdn.example.com/assets';
const webpackConfig = {
  plugins: [new HoneybadgerSourceMapPlugin({
    apiKey: 'abc123',
    assetsUrl: ASSETS_URL,
    revision: 'main',
    // You can also enable deployment notifications:
    deploy: {
       environment: process.env.NODE_ENV,
       repository: "https://github.com/yourusername/yourrepo"
    }
  })]
}

Rails Webpacker config/webpack/environment.js

const { environment } = require('@rails/webpacker')
const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack')

// Assumes Heroku / 12-factor application style ENV variables
// named GIT_COMMIT, HONEYBADGER_API_KEY, ASSETS_URL
const revision = process.env.GIT_COMMIT || 'main'

environment.plugins.append(
  'HoneybadgerSourceMap',
  new HoneybadgerSourceMapPlugin({
    apiKey: process.env.HONEYBADGER_API_KEY,
    assetsUrl: process.env.ASSETS_URL,
    silent: false,
    ignoreErrors: false,
    revision: revision
  }))

module.exports = environment

Development

  1. Run npm install
  2. Run the tests with npm test
  3. Build/test on save with npm run build:watch and npm run test:watch

See the /example folder for a project to test against.

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