ember-cli-sentry
raw JSON → 4.1.0 verified Fri May 01 auth: no javascript maintenance
An ember-cli addon that integrates Sentry (Raven.js) error tracking into Ember.js applications. The current stable version is 4.1.0, released in 2019, with maintenance releases since then. It supports Node 6+ and Ember CLI 2.13+. Key differentiators: provides an Ember service for reporting errors, automatic global error catching for Ember.onerror and RSVP, and configuration via environment variables. Compared to manual Raven.js integration, it offers idiomatic Ember conventions and easier setup.
Common errors
error ENOENT: no such file or directory, open 'node_modules/ember-cli-sentry/addon/services/raven.js' ↓
cause The addon's service file is missing or not properly linked; often due to incomplete install or version mismatch.
fix
Reinstall the addon:
rm -rf node_modules && npm install or upgrade ember-cli. error Uncaught TypeError: Cannot read property 'captureException' of undefined ↓
cause The raven service was not injected in the component/route.
fix
Ensure
@service raven is present in the class. error sentry.dsn is not a string ↓
cause The 'dsn' property in config is missing or not a valid string.
fix
Set a valid sentry DSN in config/environment.js:
sentry: { dsn: 'https://key@o0.ingest.sentry.io/0' }. error Raven is not defined ↓
cause Trying to access Raven global before initialization; or addon not properly loaded.
fix
Use the raven service instead of Raven global.
Warnings
breaking v4.0.0 requires Node >=6 and Ember CLI >=2.13; ember-cli-babel updated to v7, which may break apps using older babel configs. ↓
fix Upgrade Node and Ember CLI to supported versions; ensure project uses ember-cli-babel v7 compatible config.
breaking v3.0.0 removed implicit 'raven' service injection; you must manually inject the service in components/routes. ↓
fix Add @service raven in your Ember classes where you need Sentry logging.
breaking v3.0.0 removed config property 'ignoreErrors'; use Raven option 'ignoreErrors' via 'ravenOptions.ignoreErrors' instead. ↓
fix Move ignoreErrors to ravenOptions in sentry config.
breaking v3.0.0 removed 'serviceName' property; service is fixedly named 'raven'. ↓
fix Replace any custom serviceName references with 'raven' when injecting.
deprecated The addon is no longer actively maintained; consider migrating to '@sentry/ember' for official Sentry support. ↓
fix Replace ember-cli-sentry with @sentry/ember: ember install @sentry/ember; adjust config.
gotcha Content Security Policy (CSP) must allow connections to app.getsentry.com; otherwise raven requests will be blocked. ↓
fix Add 'connect-src app.getsentry.com' to CSP rules.
gotcha Setting `development: true` disables sending to Sentry but still logs to console; this may cause confusion in development mode. ↓
fix Ensure sentry config property 'development' is correctly set per environment.
Install
npm install ember-cli-sentry yarn add ember-cli-sentry pnpm add ember-cli-sentry Imports
- default wrong
const sentry = require('ember-cli-sentry');correctimport sentry from 'ember-cli-sentry'; - service wrong
import sentry from 'ember-cli-sentry/services/raven';correctimport { inject as service } from '@ember/service'; const sentry = service('raven'); - config wrong
// Attempting to import Raven from node_modulescorrect// config/environment.js module.exports = function(environment) { return { sentry: { dsn: '...' } }; };
Quickstart
ember install ember-cli-sentry
// config/environment.js
module.exports = function(environment) {
var ENV = {
sentry: {
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
development: (environment === 'development'),
debug: true,
globalErrorCatching: true
}
};
return ENV;
};
// In any component or route
import { inject as service } from '@ember/service';
export default class MyComponent extends Component {
@service raven;
handleError() {
this.raven.captureException(new Error('Something went wrong'));
}
}