tl;dr:

  1. We have a Weback Plugin to upload JavaScript Source Maps to our API.
  2. There is an example application written on Rails 5 demonstrating the plugin's use with Rails Webpacker.

Back in August we released source map upload via a new API for minified JavaScript. Now we are happy to announce the release of our Honeybadger Weback Plugin that uploads the source map produced when minifying JavaScript to our API.

Plugin

The plugin is really easy to configure, your webpack.config.js can be as simple as this:

const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack')
const webpackConfig = {
  plugins: [new HoneybadgerSourceMapPlugin({
    apiKey: 'your api key',
    assetsUrl: 'https://cdn.example.com/assets',
    revision: 'master'
  })]
}

Weback Plugin's README documents additional parameters that can be configured for your use case.

Example Application

We also created a Rails 5 example application that demonstrates the use of our source map plugin with Rails Webpacker. Your config/webpack/environment.js can be as simple as this:

const { environment } = require('@rails/webpacker')
const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack')
const revision = process.env.GIT_COMMIT || 'master'

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

module.exports = environment

When you run the application it has two buttons, Say Hello and Throw Error. When you click the Throw Error button, if you have your environment setup correctly, it will record a JavaScript exception back to Honeybadger. The source is here.

app.png

Honeybadger Panel

When you go to your application's Honeybadger Panel and view an exception you'll see that the backtrace correctly maps to the line numbers of the un-minified JavaScript file thanks to the source map that the plugin uploaded to the API.

backtrace.png

Try Honeybadger for FREE

Honeybadger combines the best of error tracking and performance monitoring into one simple interface—with support for all the frameworks you use. It’s the best way to gain real-time insights into the health of your applications.
Start free trial
Easy 5-minute setup — No credit card required
Mike Mondragon

A programmer and long time friend of the Honeybadger crew.

Get the Honeybadger Newsletter

Join our community of kick-ass developers as we learn engineering, DevOps, and cloud architecture.

    We'll never spam you; we will send you cool stuff like exclusive content, memes, and swag.

    An advertisement for Honeybadger that reads 'Move fast and fix things.'

    "This was the easiest signup experience I've ever had. Amazing work." — Andrew McGrath

    Get started for free
    Simple 5-minute setup — No credit card required