Breaking frontend changes for custom plugins

Hey everyone, we are making some changes to our frontend that can potentially break custom plugins. Note that “custom” in this case means integrations that you have written yourselves, and it does not refer to plugins that come included with Sentry.

The change being made is that our main javascript bundle will be loaded asynchronously. This means that certain javascript globals accessed in django templates will no longer be available. If you have a plugin that uses any of these globals inside your templates:

  • window.SentryApp
  • window.PropTypes
  • window.React
  • window.ReactDOM
  • window.Reflux
  • window.Router
  • window.Sentry
  • window.moment
  • window.createReactClass
  • window.jQuery / window.$

… then this breaking change will apply to you.

Migration

We’ve outlined the necessary steps below if your plugin uses 1) jQuery and/or 2) any of the above globals.

jQuery

Please be aware that if you’re using jQuery, we highly recommend loading it from your django template as jQuery will be removed from our main frontend application in the future:

  {% asset_url 'sentry' 'vendor/jquery.2.2.4.min.js' as jquery_url %}
  {% script src=jquery_url %}{% endscript %}

Other globals

Since this set of globals may not be available when the DOM is ready (and when the inline javascript in the django template is executed), we have provided a callback (that is available now) for when the Sentry application is initialized and the globals are ready.

window.__onSentryInit.push({
  name: 'onReady',
  onReady: (globals) => {
    // You can access the globals previously exposed to `window` here,
    // for example: `globals.SentryApp`
  }
})

Please let us know in this post if you do rely on these globals, as we would like to minimize the set of exposed globals in the future.

1 Like