nextfaze / angular-rollbar Goto Github PK
View Code? Open in Web Editor NEWRollbar logging service for Angular 2+
License: MIT License
Rollbar logging service for Angular 2+
License: MIT License
I think I followed the instructions with my Angular CLI project, but am getting these errors in the console:
zone.js:645 Error: Uncaught (in promise): TypeError: Rollbar.init is not a function
TypeError: Rollbar.init is not a function
at new RollbarService (rollbar.service.js:23)
at _createClass (core.es5.js:9601)
at _createProviderInstance$1 (core.es5.js:9573)
at initNgModule (core.es5.js:9527)
at new NgModuleRef_ (core.es5.js:10635)
at createNgModuleRef (core.es5.js:10619)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.es5.js:12903)
at NgModuleFactory_.webpackJsonp.../../../core/@angular/core.es5.js.NgModuleFactory_.create (core.es5.js:13898)
at core.es5.js:4556
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at new RollbarService (rollbar.service.js:23)
at _createClass (core.es5.js:9601)
at _createProviderInstance$1 (core.es5.js:9573)
at initNgModule (core.es5.js:9527)
at new NgModuleRef_ (core.es5.js:10635)
at createNgModuleRef (core.es5.js:10619)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.es5.js:12903)
at NgModuleFactory_.webpackJsonp.../../../core/@angular/core.es5.js.NgModuleFactory_.create (core.es5.js:13898)
at core.es5.js:4556
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at resolvePromise (zone.js:770)
at zone.js:821
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:191)
at drainMicroTaskQueue (zone.js:584)
at <anonymous>
api.onUnhandledError @ zone.js:645
handleUnhandledRejection @ zone.js:667
_loop_1 @ zone.js:658
api.microtaskDrainDone @ zone.js:662
drainMicroTaskQueue @ zone.js:592
Error: Uncaught (in promise): TypeError: Rollbar.init is not a function
TypeError: Rollbar.init is not a function
at new RollbarService (rollbar.service.js:23)
at _createClass (core.es5.js:9601)
at _createProviderInstance$1 (core.es5.js:9573)
at initNgModule (core.es5.js:9527)
at new NgModuleRef_ (core.es5.js:10635)
at createNgModuleRef (core.es5.js:10619)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.es5.js:12903)
at NgModuleFactory_.webpackJsonp.../../../core/@angular/core.es5.js.NgModuleFactory_.create (core.es5.js:13898)
at core.es5.js:4556
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at new RollbarService (rollbar.service.js:23)
at _createClass (core.es5.js:9601)
at _createProviderInstance$1 (core.es5.js:9573)
at initNgModule (core.es5.js:9527)
at new NgModuleRef_ (core.es5.js:10635)
at createNgModuleRef (core.es5.js:10619)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.es5.js:12903)
at NgModuleFactory_.webpackJsonp.../../../core/@angular/core.es5.js.NgModuleFactory_.create (core.es5.js:13898)
at core.es5.js:4556
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at resolvePromise (zone.js:770)
at zone.js:821
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:191)
at drainMicroTaskQueue (zone.js:584)
at <anonymous>
api.onUnhandledError @ zone.js:645
handleUnhandledRejection @ zone.js:667
_loop_1 @ zone.js:658
api.microtaskDrainDone @ zone.js:662
drainMicroTaskQueue @ zone.js:592
I did
npm install angular-rollbar --save
import { RollbarModule, RollbarService } from 'angular-rollbar';
to the app.moduleRollbarModule.forRoot({ accessToken: 'xxx' })
to the imports
in the app.module{ provide: ErrorHandler, useClass: RollbarService }
to the providers
in the app.moduleimport { RollbarService } from 'angular-rollbar';
to the app.componentprivate rollbar: RollbarService
to the constructor of the app.componentrollbar.info('Logging to Rollbar!');
inside the constructor of the app.componentDid I miss anything?
(Sorry if I missed something simple, Angular noob)
Hi, thanks for your excellent plugin and your effort. Do you have plans to add the environment info?
payload: {
environment: ????
}
Thanks!!
import { RollbarModule } from 'angular-rollbar';
import { RollbarService } from 'angular-rollbar';
You need to use :
import { RollbarModule } from 'angular-rollbar/lib';
import { RollbarService } from 'angular-rollbar/lib';
Rollbar's JS library supports scopes:
https://rollbar.com/docs/notifier/rollbar.js/#rollbarscope
Should integrate this into the service
To extends the RollbarService and implement own ErrorHandler, it will be nice if rollbar property will be protected to access when extends class.
I want to use rollbar to send my errors, but I still want to log my error in console, and if I extends RollbarService to implements my own handleError I cant access to rollbar property because is private.
export class ErrorHandlerCustom extends RollbarService {
handleError(err: any) {
this.rollbar.error(err.originalError || err); // This fails because is private
console.log(err)
}
With the following config error messages arrive in Rollbar but do not show in the console.
RollbarModule.forRoot({
accessToken: 'TOKEN',
verbose: true,
captureUncaught: true,
payload: {
environment: 'dev'
}
})
Is there a trick or dependency that I'm missing?
Thanks for your help and all the best,
MrMorice
Rollbar 2 was released
https://github.com/rollbar/rollbar.js/blob/master/CHANGELOG.md
2.0.4 latest version
Blog post: https://rollbar.com/blog/rollbar-javascript-error-monitoring-update/
https://www.reddit.com/r/Angular2/comments/ay93z1/a_misspelling_in_the_html_is_causing_an_infinite/
angular/angular#17010
Angular can spam errors when a template is malformed.
I've exceeded my rollbar limit a couple of times due to this issue, there should be a flag in this service that debounces/stops the error when the angular error cache floods. They haven't provided a clear way to deal with this, and rollbar would probably appreciate if this framework provided a way to stop a flood of errors.
This code looks like it could be useful for fixing things up:
https://www.reddit.com/r/Angular2/comments/ay93z1/a_misspelling_in_the_html_is_causing_an_infinite/ei2chu9?utm_source=share&utm_medium=web2x
The module itself is fairly simple but still needs tests. At the moment coveralls is lying, currently coverage is 0.
[email protected] requires a peer of @angular/common@>=2.0.0 but none is installed. You must install peer dependencies yourself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.