Share on Twitter
Share on Facebook
Share on HackerNews
Share on LinkedIn

Sentry JavaScript SDK 2.0.0 is available now

We’ve just released version 2.0.0 of our client JavaScript integration library, Raven.js. This version introduces some important major changes from 1.3.0. Let’s go over them.

Reports now sent via HTTP POST

Raven.js 2.0.0 now transmits error reports to the Sentry server using HTTP POST, unlike previous versions which used HTTP GET. This means that exception data is no longer limited by browsers’ URI character length limits, putting an end to 417 HTTP errors (URI too long), and allowing developers to transmit additional extra data fields without worry.

Note that if you are using Sentry On-Premise, you must be using Sentry server v8 in order for HTTP POST requests to work.

Better automatic wrapping of functions

To give you complete stack traces in all browsers, Raven.js 2.0.0 extends browser built-ins like setTimeout and addEventListener in order to automatically wrap and capture errors from your functions. We’ve found this gives better stack trace results in Safari 9.x and earlier, Internet Explorer 10, and even the new Microsoft Edge.

The jQuery, Native, and Backbone plugins have been removed

We’ve removed these plugins because they’re no longer necessary – by more aggressively wrapping browser built-ins, we’re removed the need to have dedicated plugins for some libraries. You’ll still get the same full stack traces from errors triggered inside jQuery and/or Backbone applications as before, but without the need to declare additional plugin dependencies.

This means that if you were previously using a “plugin” variant from the Raven CDN, e.g.

<script src="https://cdn.ravenjs.com/1.3.0/native,backbone/raven.min.js"></script>

You’ll now only need the following in 2.0.0:

<script src="https://cdn.ravenjs.com/2.0.0/raven.min.js"></script>

New plugin API with better CommonJS support

The Angular error tracking, Ember error tracking, and React error tracking plugins are still available because these frameworks provide their own global error handler hook for framework-specific errors and warnings.

However, if you use these plugins via CommonJS (either using Browserify or Webpack), the API for including them has changed:

var Raven = require('raven-js');
Raven
  .config('YOUR DSN')
  .addPlugin(require('raven-js/plugins/angular'))
  .install();

If you load raven-js and plugins directly from our CDN, don’t worry – you don’t have to change anything.

It’s official; Semver going forward

Despite most of the changes above being transparent to users, the reason we’re labeling this version 2.0.0 is because the Raven.js project is now following Semver (Semantic Versioning). Any future incompatible API changes will constitute a new major version (e.g. 3.0.0). So you can feel confident that pinning to “^2.0.0” won’t accidentally cause your build to download an incompatible version of Raven.js.

Get started now

As always, Raven.js can be served directly from our CDN:

<script src="https://cdn.ravenjs.com/2.0.0/raven.min.js"></script>

Or installed using npm (and bundled with Browserify or Webpack):

$ npm install raven-js@2.0.0

A quick reminder that Raven.js is for client JavaScript running in the browser. For using Sentry with Node.js, see raven-node.

That about covers what’s new in this version. As always, we appreciate your feedback and concerns.

Your code is broken. Let's Fix it.
Get Started

More from the Sentry blog

ChangelogCodecovDashboardsDiscoverDogfooding ChroniclesEcosystemError MonitoringEventsGuest PostsMobileMoonlightingOpen SourcePerformance MonitoringRelease HealthSDK UpdatesSentry
© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.