CDN guide

How to load @bugsnag/js using the CDN

For browser-only error reporting, we provide a hosted option on our CDN. This means you can get started with BugSnag with a simple <script/> tag.

Loading from the CDN

To load BugSnag from the CDN, add the following script tags to the <head/> of your page:

<script src="//d2wy8f7a9ursnm.cloudfront.net/v8/bugsnag.min.js"></script>
<script>Bugsnag.start('YOUR_API_KEY')</script>

The first line loads the BugSnag library from the CDN and the second configures it with your API key. You can alternatively supply a configuration object as documented in configuration options.

Specifying a version

You can tweak the exact URL depending on whether you want to lock to a specific version or accepting varying levels of updates. Each release is versioned according to semver.

The latest available version of bugsnag-js is v8.1.3.

The URL in the example below specifies the version to be v8. 8 is just the “major” semver component. This means you would receive new minor and patch versions automatically as they are published:

<script src="//d2wy8f7a9ursnm.cloudfront.net/v8/bugsnag.min.js"></script>

When a new major version of @bugsnag/js is released, you will need to update the URL accordingly to receive updates.

To only allow patch updates, specify the major and minor components: v8.1

<script src="//d2wy8f7a9ursnm.cloudfront.net/v8.1/bugsnag.min.js"></script>

Or, lock down an exact version: v8.1.3

<script src="//d2wy8f7a9ursnm.cloudfront.net/v8.1.3/bugsnag.min.js"></script>

See semver.org for information on the semantics of version numbers.

Our recommendation

We recommend pinning to a specific version and periodically updating.

Automatically accepting new versions of dependencies in your software is convenient, but has tradeoffs. Whilst we make every effort to be conservative and cautious with our minor/patch releases, unforeseen issues and incompatibilities can arise.

For these reasons, the safest approach involves manually updating the version, testing it in a development/staging environment and only then shipping to production.

Non-minified version

To use the non-minified version, substitute bugsnag.min.js for bugsnag.js in your script tag.

The minified version ships with source maps, so there are very few use cases where you would want the non-minified version (for example, debugging an issue in a browser that doesn’t support source maps).

<!-- only do this in development or for debugging purposes -->
<script src="//d2wy8f7a9ursnm.cloudfront.net/v8/bugsnag.js"></script>