dschmidt / ember-cli-deploy-sentry

An ember-cli-deploy-plugin to upload javascript sourcemaps to Sentry
MIT License
42 stars 51 forks source link

How is the revision meta tag supposed to be used? #31

Open RobinDaugherty opened 7 years ago

RobinDaugherty commented 7 years ago

The readme says:

When you setup raven-js you can retrieve it like this:

Raven.config({
    release: $("meta[name='sentry:revision']").attr('content')
});

How is this supposed to work with ember-cli-sentry?

RobinDaugherty commented 7 years ago

To amplify, here is what I have observed:

  1. Release version is created during deployment using ember-cli-deploy-revision-data plugin.
  2. ember-cli-deploy-sentry uses this release version to upload source maps.
  3. raven-js library uses ENV.APP.version when sending an exception report to sentry.
  4. Where is the value of ENV.APP.version generated? No idea yet, will require a lot of reading of code. It is however, package version + git commit.
  5. Is it possible to set ENV.APP.version during deployment? Doesn't seem possible to get access to the build information in environment.js.

I tried adding to my raven service:

import Raven from 'ember-cli-sentry/services/raven';

let releaseMetaTag = document && document.querySelector("meta[name='sentry:revision']");
let release = releaseMetaTag && releaseMetaTag.getAttribute('content');
if (release) {
  Raven.callRaven('setRelease', release);
}

export default Raven.extend({}) // snipped the boilerplate

This fails. Should I instead use window.Raven directly? Is this even the correct place to do this?

duizendnegen commented 7 years ago

I originally worked on this... it doesn't work as well as it should. The break (as you note correctly) is in that ENV.APP.version is used for sending an exception report, which was supposed to be meta[name='sentry:revision'] but has deviated from it, in a way that I don't recall. This already was supposed to be happening (see https://github.com/dschmidt/ember-cli-deploy-sentry/commit/2a561ff19d19afab5eae338c47707f9c8729c8a8) but something, somewhere went wrong...

Your Raven service sounds good - quite possibly we should stick something like that in an initializer instead of a service.