Frequently asked questions

Contents

Why isn’t Bugsnag automatically reporting exceptions?

If manual calls to bugsnag.notify() are showing up in the Bugsnag dashboard, but uncaught exceptions are not, then there are several possible reasons:

1. Check your configuration

The following configuration options might have been used to disable the autonotify behavior.

2. Errors thrown from the console

An error that is explicitly thrown in the browser console, e.g. throw new Error('test'), will not automatically be tracked. This is because it does not trigger the window.onerror handler that Bugsnag uses to track uncaught exceptions.

3. Cross origin script errors

Bugsnag ignores cross domain script errors by default, because they contain no useful information. When Bugsnag encounters these errors it will log to the browser console: [Bugsnag] Ignoring cross-domain script error.

See the documentation on capturing cross-domain script errors for the solution and more information.

4. Code generated with eval (e.g from webpack)

Many tools such as webpack will generate code with eval as a cheap alternative to source maps. Like cross origin script errors, these errors from evaled code hide all useful information and will thus be ignored.

If you are using webpack, you should change the devtool option in your webpack config to something that does not use eval. We recommend source-map or inline-source-map.

How do I show un-minified source code on my Bugsnag dashboard?

Bugsnag supports source maps to reverse javascript minification. If you include a magic comment at the end of your javascript file that points to the location of a source map, we will expand the lines in your stacktrace.

For example, the source map comment at the bottom of bugsnag.js looks similar to this:

//# sourceMappingURL=bugsnag.min.js.map

Most modern minifiers and bundlers support source maps. We use UglifyJS2.

To support source maps Bugsnag needs to download both your minified code and your source maps. It doesn’t need to fetch your original source files. Legitimate Bugsnag requests originate from the IP address 107.22.198.224 if you need to open up your firewall to allow access.

How can I adjust the number of errors sent per page load?

By default only 10 errors are allowed per page load. This is to prevent wasting a user’s bandwidth sending thousands of exceptions to Bugsnag. This count is automatically reset each time the page location changes via pushstate/replacestate, however if you have a long-running single page app that does not change URL, you can reset manually by using:

bugsnagClient.refresh()

How can I lock to a specific version of the Bugsnag library via the CDN?

We will occasionally update the minor/patch version of Bugsnag on the CDN to improve the quality of our notifier without breaking backward compatibility. If you need assurance that the JavaScript will never change, feel free to include the specific version directly.

<script src="https://d2wy8f7a9ursnm.cloudfront.net/v4.0.0/bugsnag.min.js"></script>

If you have specific requirements for Javascript, you’re welcome to host versions of bugsnag-js on your own site or CDN.

If you’d like to avoid an extra blocking request, you can include the javascript in your asset compilation process so that it is inlined into your existing script files. The only thing to be sure of is that Bugsnag is included before the rest of your JavaScript runs – Bugsnag can only catch errors in code that executes after it.

How can I get error reports from browser extensions?

Bugsnag’s backend automatically ignores errors if they appear to come from browser extensions, since these errors usually aren’t actionable for site owners and often aren’t related the current page’s code at all.

If you have a special case where you want to know about errors that come from extensions — for example, if you are attempting to monitor a browser extension itself — you may need to modify the error stacktrace you send to Bugsnag to work around this feature. For example, for a Chrome extension, you might add something like this to your beforeNotify function:

bugsnag({
  beforeSend: function (report) {
    report.stacktrace = report.stacktrace.map(function (frame) {
      return frame.file.replace(/chrome-extension:/g, 'chrome_extension:')
    })
  }
})

Can I use Bugsnag with CSP?

Yes, you can use Bugsnag with CSP even if you do not use unsafe-eval or unsafe-inline directives. If you are following our standard setup instructions, you’ll need to add these two items to your existing script source and image source CSP headers:

script-src https://d2wy8f7a9ursnm.cloudfront.net
image-src https://notify.bugsnag.com

If you’d prefer, you can also host bugsnag-js on your own site or CDN to avoid adding the bugsnag-js script-src. Just be sure to load it before your other javascript so it can report errors in as much of you code as possible.

Can I load Bugsnag async?

We recommend loading Bugsnag synchronously before any of your other scripts to report as many of your errors as possible.

If async loading of all of your javascript is important to you, we recommend bundling bugsnag-js with your own scripts and including it as the first file in your asset compilation process so that it can still run before your other scripts.

It is available on npm as bugsnag-js.

Is Bugsnag blocked by ad blockers?

Some ad blockers will prevent the Bugsnag notifier from loading and therefore it will not report errors.

Note: Bugsnag has been removed from uBlock and AdBlock, so they no longer interfere with Bugsnag.

The following ad blockers are known to block Bugsnag by default:

  • 1Blocker: Bugsnag will be blocked unless the Bugsnag rule is disabled.
  • Privacy Badger: Bugsnag will be blocked unless explicitly whitelisted.

The following ad blockers may block Bugsnag if the default configuration is changed:

  • Ghostery with the Site Analytics category enabled.