New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module 'ngRaven' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. #529
Comments
+1 |
Is there something actionable we can do here? I'm a bit confused. :) |
Oh, jk, I read the Stackoverflow. It works with the angular-raven package, but not ours. |
Per the current documentation, the sentry angular plugin should now work https://docs.getsentry.com/hosted/clients/javascript/integrations/angular/ |
Might be the directory 'dist' missing in 'app/bower_components/raven-js/plugins/angular.js'? According to docs [https://docs.getsentry.com/hosted/clients/javascript/integrations/angular/#bower] it should be:
|
Following the documentation angular can't find the module for me. The stack overflow solution works for me though. |
That would definitely do it. If somebody here could provide me with a concrete example, I'd be glad to dig into this. |
@benvinegar https://plnkr.co/edit/S1Dk9t?p=preview this is a simple sample of the error, Based on https://github.com/getsentry/raven-js/blob/master/docs/integrations/angular.rst But importing only that as the docs says throws an error, please check the log in the plnkr Maybe this is just a misinterpretation of the docs? |
Any news on this? I think the angular plugin only works for CommonJs, since this is actually never called when just including the file. Please fix so we can use the plugin |
Here is the simplest example following your integration page that does not work: https://plnkr.co/edit/M5nt6Y?p=preview |
@RobertBaron @mebibou – in both examples you need to configure Raven before initializing your app. Plugins aren't initialized until This is in all the documentation examples, for example: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<script src="https://cdn.ravenjs.com/3.6.1/angular/raven.min.js"></script>
<script>Raven.config('https://<key>@app.getsentry.com/<project>').install();</script> Although it could be made more explicit that your application script (e.g. |
Oh ok this actually goes against the Angular way where we usually do this kind of configuration in a module that would require I think you should specify this in the documentation as it is not specified at all. |
+1 |
See #413, @benvinegar Is it ready to tackle? |
@Sija – given that people keep tripping up on this, I'm fine with merging. Though I'm worried about the case where someone might have declared Raven before Angular. But at least CDN users need to upgrade manually. |
Don't forget to add the bit in bold below Raven |
@theatrain besides that you need to add an override on your package.json if using gulp inject or anything similiar that includes packages dependencies onto your html automatically.
|
I found a good workaround for grunt as well since everything was uglified and minified: My 'use strict';
angular
.module('sraApp', [
'ngRaven'
]); I made another file called // redacted sensitive info
Raven
.config('https://<code>@sentry.io/<myapp>')
.addPlugin(Raven.Plugins.Angular)
.install(); And in the index.html instead of inline scripts: <!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/raven-js/dist/raven.js"></script>
<!-- endbower -->
<!-- Outside of auto-managed bower, but still inside compile -> vender.js -->
<script src="bower_components/raven-js/dist/plugins/angular.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/raven.js"></script>
<script src="scripts/app.js"></script>
<!-- endbuild --> Now when I Overall the flow is as follows (documentation is correct)
Also another thing to note that most configs can happen later (though you miss tags on any issues during bootstrap) For example a heroku config loaded after the fact. 'use strict';
angular.module('sraApp')
.run(function (Raven, HEROKU_APP_ID, HEROKU_APP_NAME, HEROKU_RELEASE_CREATED_AT, HEROKU_RELEASE_VERSION, HEROKU_SLUG_COMMIT, HEROKU_SLUG_DESCRIPTION, NODE_ENV) {
Raven.setRelease(HEROKU_RELEASE_VERSION);
Raven.setEnvironment(NODE_ENV);
Raven.setTagsContext({
release_date: HEROKU_RELEASE_CREATED_AT,
git_commit: HEROKU_SLUG_COMMIT,
slug_description: HEROKU_SLUG_DESCRIPTION,
application: {
name: HEROKU_APP_NAME,
id: HEROKU_APP_ID,
}
});
}); |
Any update on this? Also got problems here with our karma test suite. |
@xeroxoid We also had problems with this during karma tests and were able to get around it. In our case we were skipping the The problem with that is raven-js doesn't do things "the angular way" with modules - and instead only registers the The To fix this, we made it so that This allows raven-js to properly register the angular module. Hope that helps! |
We're doing the same, but we pass a fake DSN in instead (this is for our dev env). Something like |
Closing due to long inactivity. This thread also contains few workarounds just in case. Please feel free to reopen this issue if it's still relevant in any way. |
This is my order of files in karma.conf.js for running karma jasmine uint tests..
files: ['app/bower_components/jquery/dist/jquery.min.js',
'app/bower_components/angular/angular.min.js',
'app/bower_components/raven-js/dist/raven.js',
'app/bower_components/raven-js/plugins/angular.js'
]
Event though I included 'app/bower_components/raven-js/plugins/angular.js' I'm getting the error stating the module 'ngRaven' is not available.
The text was updated successfully, but these errors were encountered: