This addon will allow you to report errors to Raygun from your Ember CLI app using raygun4js.
❤️ Please open an issue if you run into any troubles!
$ ember install ember-cli-raygun --api_key='paste_your_api_key_here'
Alternatively, you can set your API key manually by starting with:
$ ember install ember-cli-raygun
Next, set your API key in config/environment.js
:
var ENV = {
// ...
raygun: {
apiKey: "paste_your_api_key_here",
enableCrashReporting: (environment === "production")
}
// ...
The default blueprint (which runs during ember install ember-cli-raygun) will add the above config in your app's config/environment.js file.
Raygun will now track errors in your deployed application. By default, Ember CLI Raygun is disabled unless your environment is set to "production". You can configure this behavior in config/environment.js
.
ember-cli-raygun
will automatically inject the raygun4js bootstrap script into the head of your Ember app. This is the most reliable way to catch errors (even during app initialization).
If you’re using CORS without unsafe-inline
, you’ll need to add the following directives to ensure rg4js
and Raygun load correctly:
-
script-src
- 'sha256-kOJzCjwwBHVC6EAEX5M+ovfu9sE7JG0G9LcYssttn6I='
- 'http://cdn.raygun.io'
-
connect-src
Functions you might need on rg4js
are exposed as an Ember Service, for instance tracking custom events:
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class IndexRoute extends Route {
@service raygun;
beforeModel() {
this.raygun.trackEvent({
type: 'customTiming',
name: 'IndexRouteBeforeModel',
duration: 1200
})
}
}
Check out the Customers section in the raygun4js documentation for full details.
Add the following snippet into your application route in app/routes/application.js
:
// ...
@service user;
@service raygun;
beforeModel: () {
this.setRaygunUser();
},
setRaygunUser: () {
this.raygun.setUser({
identifier: this.get("user.id"),
isAnonymous: false,
email: this.get("user.email"),
firstName: this.get("user.firstName"),
fullName: this.get("user.fullName")
});
},
// ...
Thanks to:
- @aklkv
- @jakesjews
- @jrjamespdx
- @fundead
- @JonathanPrince
- @j5alive
- @josephambe
- @pixelhandler
- @archit
- @cibernox
- @dwnz
For your contributions on the previous version of this addon :)
Pull requests are welcome!
git clone
this repositorynpm install
ember test
ORember test --server
There’s a detailed test harness in the dummy
app so please check that your changes work end-to-end by running that.