Skip to content

Instantly share code, notes, and snippets.

@searls
Last active January 5, 2019 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searls/7e4ad178d52d83faca846e21fd4aaa4d to your computer and use it in GitHub Desktop.
Save searls/7e4ad178d52d83faca846e21fd4aaa4d to your computer and use it in GitHub Desktop.
Downgrading the JS Bugsnag client from 3.x to 2.x

Downgrading the JS Bugsnag client from 3.x to 2.x

Why?

It's smaller (as of 2019-01-05). The size of my application was reduced from 223KB to 194KB. After talking to Gary, he mentioned that James Smith had pointed him to the smaller legacy client, so I tried it out.

How?

To keep using Bugsnag@2, grab this:

http://d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.js

You can see the README for this version on the latest 2.x tag on GitHub

Following these instructions, I just saved the old file to my project, imported it for the side effect (since it defined a window.Bugsnag global), and configured it:

import './vendor/bugsnag-small'

const startMonitoring = (userId) = {
  const client = window.Bugsnag.noConflict()
  client.apiKey = '1234567890'
  client.disableLog = true
  client.autoNotify = true
  client.notifyHandler = 'xhr'
  client.user = { id: userId }
  return client
}

And then where my app boots up, I just invoke startMonitoring(42) and I'm off to the races. In particular, I wasn't able to get it to report any exceptions unless I manually enabled autoNotify (which should default to true) and notifyHandler to 'xhr' (which defaults to adding a magic pixel to the DOM, IIRC).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment