Coder Social home page Coder Social logo

rollbar / rollbar.js Goto Github PK

View Code? Open in Web Editor NEW
564.0 564.0 212.0 16.23 MB

Error tracking and logging from Javascript to Rollbar

Home Page: https://docs.rollbar.com/docs/javascript

License: MIT License

JavaScript 100.00% Makefile 0.01%
crash-reporting error-handling error-monitoring errors expressjs javascript nextjs nodejs react rollbar typescript

rollbar.js's Introduction

rollbar-logo

Rollbar.js

Proactively discover, predict, and resolve errors in real-time with Rollbar’s error monitoring platform. Start tracking errors today!

Build Status Code Quality: Javascript Total Alerts


Key benefits of using Rollbar.js are:

  • Cross platform: Rollbar.js supports both server-side and client-side Javascript, including frameworks such as React, Angular, Express, Next.js and more.
  • Telemetry: The telemetry timeline provides a list of “breadcrumbs” events that can help developers understand and fix problems in their client-side javascript. Learn more about telemetry.
  • Automatic error grouping: Rollbar aggregates Occurrences caused by the same error into Items that represent application issues. Learn more about reducing log noise.
  • Advanced search: Filter items by many different properties. Learn more about search.
  • Customizable notifications: Rollbar supports several messaging and incident management tools where your team can get notified about errors and important events by real-time alerts. Learn more about Rollbar notifications.

Setup Instructions

  1. Sign up for a Rollbar account.
  2. For client-side Javascript, follow the Browser Quick Start instructions. For Node.js, follow the Server Quick Start.

Usage and Reference

For complete usage instructions and configuration reference, see our Javascript SDK docs.

Release History & Changelog

See our Releases page for a list of all releases, including changes.

Help / Support

If you run into any issues, please email us at [email protected].

For bug reports, please open an issue on GitHub.

Developing

To set up a development environment, you'll need Node.js and npm.

  1. npm install -D
  2. make

To run the tests, run make test.

Contributing

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Added some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new Pull Request.

rollbar.js's People

Contributors

and-megan avatar austenlacy avatar brianr avatar cfurrow avatar chrisbarmonde avatar chrisrbnelson avatar corps avatar coryvirok avatar crisfole avatar dependabot[bot] avatar ezarowny avatar ijsnow avatar jessewgibbs avatar jondeandres avatar kmontag avatar lehresman avatar loganvolkers avatar matux avatar mrunalk avatar msokk avatar mudetroit avatar ninjz avatar paulserraino avatar pimterry avatar rivkahstandig3636 avatar rokob avatar sandstrom avatar sbezboro avatar shakiba avatar waltjones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rollbar.js's Issues

Add Bower instructions to README

Hello! I'd like to set up Rollbar using Bower. My expectation around that process would be...

  1. bower install rollbar
  2. Include dist/rollbar.min.js in my JS assets
  3. Configure _rollbarConfig

Is that all there is to it? Your tag instructions include some obfuscated code that seems to do more than just load the real library file, so it's not obvious if I need to load that in addition to rollbar.min.js. If this was made clear in the README, this process would be a lot more straightforward.

Thanks!
Andrew

"logToConsole" flag

Some users would like to have all data sent to Rollbar logged to the console, as well as sent over the net. (Or instead of, when used in combination with the "enabled" flag described in #28).

When true, a line should be written via console.log() (or the appropriate console function) containing the same/similar data as passed to the Rollbar call. Ideally, this would enable Rollbar to be a drop-in replacement for console.log.

Default false.

TypeError: e is undefined

TypeError: e is undefined
...wrapped){b._wrapped=function(){try{return b.apply(this,arguments)}catch(c){throw...

I have integrated rollbar API for javascript. In my firexfox -> console -> All tab I am getting above error message. I have rollbar config script immediately after body tag. I tried to debug the cause of this error and it seems error is in below line:

var a=b.createElement("script"), e=b.getElementsByTagName("script")[0];

I don't know what is causing e as undefined.

1.1.12 crashes in IE8

Using version 1.1.12, or later, results in a crash in IE8.

When loading our application I get an browser error with the message "Stack overflow at line 1". Loading the app with dev tools open fills the script console with

LOG: Rollbar:,TypeError: 'DOMException' is undefined

Since I can't seem to find a list of supported browsers, and more specifically that IE8 is not supported, I must then assume that it is indeed supported.

This is rather serious as a patch version is suddenly crashing our application, without us finding out unless our customers tell us or, as in this case, we did some testing for an upcoming release.

Rollbar 1.2.1 not sending out requests (broken)

I'm not sure what the exact issue is, but I've noticed that after upgrading an application from 1.1.15 to 1.2.1 there were no outbound requests from Rollbar. Both the options and the error pushing. Because of this I've downgraded back to 1.1.15, which works without a problem.

If there is anything I can do to help debug this please let me know, I'd be happy to help.

Stack overflow in Util.merge in IE8

Consistently getting an infinite loop in IE8 at this clause:
c = g[b], d = a[b], g !== d && (j && d && (d.constructor == Object || (e = d.constructor == Array)) ? (e ? (e = !1, f = []) : f = c && c.constructor == Object ? c : {}, g[b] = Util.merge(f, d)) : void 0 !== d && (g[b] = d)) (in Util.merge)

Even Util.merge([], []); will cause the error. I'm using Rollbar in conjunction with Ember, and it seems to be due to Ember extending Array's prototype.

http://emberjs.jsbin.com/dubuzobe/1/

requests made from browserify fail

I am using browserify and its http module sends the user credentials by default (withCredentials: true)

Because rollbar returns a Access-Control-Allow-Origin: * chrome complains that this is not allowed.

Maybe a way to send additional parameters to SETTINGS.transport options would be nice. If you have an idea for an implementation I could do a PR.

README.md references v1.1

Is this right, now that version 1.2.1 is out?

//d37gvrvc0wt4s1.cloudfront.net/js/v1.1/rollbar.min.js

ignoredMessages should apply to regular messages too

Currently the ignoredMessages config option only applies to error messages that come from an Error object (or an uncaught error reported via window.onerror). It should probably also apply to messages that come from any direct calls to Rollbar.warning, etc. as well.

In jQuery plugin, ignore xhr status code 0

In Rollbar jQuery plugin [that wraps all ajax calls], ignore xhr status code 0. That's typically only when the user navigated away in the midst of an xhr (common, and typically harmless).

// Report any ajax errors to Rollbar
jQuery(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
  var status = jqXHR.status;
  var url = ajaxSettings.url;
  if (status) {
    window._rollbar.push({
      level: 'warning',
      msg: 'jQuery ajax error for url ' + url,
      jquery_status: status,
      jquery_url: url,
      jquery_thrown_error: thrownError,
      jquery_ajax_error: true
    });
  }
});

"enabled" flag

Some users prefer to disable in some environments (i.e. development) while leaving the code intact. We should have a global "enabled" flag (default true), which prevents data from actually being sent over the network.

checkIgnore not works correctly.

Thats doesn't work with last version:

checkIgnore: function(msg, url, lineNo, colNo, error) {
        if (url && !url.match(/^https?:\/\/www\.mycompany\.com/)) {
           // has a filename, but filename (url) is not on www.mycompany.com.
           // ignore.
           return true;
        }
        return false;
    },

I get this error:

TypeError: Object [object Array] has no method 'match'

@brianr

Rollbar 1.3.0-alpha.5 breaks IE8 at `setupCustomJSON` call.

Environment

  • Rollbar.js v1.3.0-alpha.5
  • In IE8 (for me on a VirtualBox VM)
  • Built off rollbar.umd.js (not the minified version)
  • Loaded via AMD (requirejs)

Reproduction

  • Open up a page that includes the rollbar.umd.js script. (No other actions needed).
  • Expected Behavior: No errors.
  • Actual Behavior: Bombs out with the following error
Object expected 
line 69 character 6

This corresponds to: https://github.com/rollbar/rollbar.js/blob/master/dist/rollbar.umd.js#L69

        setupCustomJSON(customJSON);

Diagnosis

Poking around a bit further, if I try and introspect setupCustomJSON right before L69, it is undefined.

        console.log("setupCustomJSON --> " + (typeof setupCustomJSON));
        setupCustomJSON(customJSON);

produces:

LOG: setupCustomJSON --> undefined

Allow script host filtering as a configuration option

As a convenience, it would be nice to supply a list of partial host strings that would feed into the Rollbar.js library, and only report errors from scripts that come from this whitelisted set of hosts.

Example:

Rollbar.global({ allowedScriptHosts: ["coolgifs.geocities.com"] });

README code still using v1.1

Am I wrong, or is the README still pointing to v1.1 when v1.1.2 is out?

!function(a,b){function c(b){this.shimId=++h,this.notifier=null,this.parentShim=b,this.logger=function(){},a.console&&void 0===a.console.shimId&&(this.logger=a.console.log)}function d(b,c,d){!d[4]&&a._rollbarWrappedError&&(d[4]=a._rollbarWrappedError,a._rollbarWrappedError=null),b.uncaughtError.apply(b,d),c&&c.apply(a,d)}function e(b){var d=c;return g(function(){if(this.notifier)return this.notifier[b].apply(this.notifier,arguments);var c=this,e="scope"===b;e&&(c=new d(this));var f=Array.prototype.slice.call(arguments,0),g={shim:c,method:b,args:f,ts:new Date};return a._rollbarShimQueue.push(g),e?c:void 0})}function f(a,b){if(b.hasOwnProperty&&b.hasOwnProperty("addEventListener")){var c=b.addEventListener;b.addEventListener=function(b,d,e){c.call(this,b,a.wrap(d),e)};var d=b.removeEventListener;b.removeEventListener=function(a,b,c){d.call(this,a,b&&b._wrapped?b._wrapped:b,c)}}}function g(a,b){return b=b||this.logger,function(){try{return a.apply(this,arguments)}catch(c){b("Rollbar internal error:",c)}}}var h=0;c.init=function(a,b){var e=b.globalAlias||"Rollbar";if("object"==typeof a[e])return a[e];a._rollbarShimQueue=[],a._rollbarWrappedError=null,b=b||{};var h=new c;return g(function(){if(h.configure(b),b.captureUncaught){var c=a.onerror;a.onerror=function(){var a=Array.prototype.slice.call(arguments,0);d(h,c,a)};var g,i,j=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];for(g=0;g<j.length;++g)i=j[g],a[i]&&a[i].prototype&&f(h,a[i].prototype)}return a[e]=h,h},h.logger)()},c.prototype.loadFull=function(a,b,c,d){var e=g(function(){var a=b.createElement("script"),e=b.getElementsByTagName("script")[0];a.src=d.rollbarJsUrl,a.async=!c,a.onload=f,e.parentNode.insertBefore(a,e)},this.logger),f=g(function(){if(void 0===a._rollbarPayloadQueue)for(var b,c,d,e,f=new Error("rollbar.js did not load");b=a._rollbarShimQueue.shift();)for(d=b.args,e=0;e<d.length;++e)if(c=d[e],"function"==typeof c){c(f);break}},this.logger);g(function(){c?e():a.addEventListener?a.addEventListener("load",e,!1):a.attachEvent("onload",e)},this.logger)()},c.prototype.wrap=function(b){try{if("function"!=typeof b)return b;if(b._isWrap)return b;if(!b._wrapped){b._wrapped=function(){try{return b.apply(this,arguments)}catch(c){throw a._rollbarWrappedError=c,c}},b._wrapped._isWrap=!0;for(var c in b)b.hasOwnProperty(c)&&(b._wrapped[c]=b[c])}return b._wrapped}catch(d){return b}};for(var i="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError".split(","),j=0;j<i.length;++j)c.prototype[i[j]]=e(i[j]);var k="//d37gvrvc0wt4s1.cloudfront.net/js/v1.1/rollbar.min.js";_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||k;var l=c.init(a,_rollbarConfig);l.loadFull(a,b,!1,_rollbarConfig)}(window,document);

Allow to define basePath for script files

I have successfully configured and installed sourcemaps in rollbar (https://rollbar.com/docs/source-maps/).

Unfortunately, with current behaviour, you assume that my assets are located under only one url (f.e. http://domain.com/js/app.js).

However, what if my assets are stored under 4 different urls? (f.e. http://userone.domain.com/js/app.js , http://usertwo.domain.com/js/app.js) . I have to upload the same sourcemap twice for each minified_url, even if those files are exactly the same.

My actual example & problem: I am using Rollbar.js in my mobile Apache Cordova application. Source urls are a little bit strange there.

Even though, I managed to synchronise the sourcemaps on Android by setting sourceMappingURLPrefix: 'file:///android_asset/www/js' in gulp-rollbar.

Unfortunately, it's not so easy for iOS, as the assets path for the iOS app is random: f.e. file:///private/var/mobile/Containers/Bundle/Application/9A5697CB-45C3-46A6-9A97-4EC7A088CDC7/CordovaSample.app/www/js/app.js, where 9A5697CB-45C3-46A6-9A97-4EC7A088CDC7 is a random hash being different with every deploy. Thus, it's almost impossible for me to make the sourcemaps working on the iOS app.

It would be great if I could set an "alias_name" for given script url, f.e.

scriptUrls = {
  "file:///private/var/mobile/Containers/Bundle/Application/9A5697CB-45C3-46A6-9A97-4EC7A088CDC7/CordovaSample.app/www/js/app.js": "/www/js/app.js"
}

OR

just configure a basePath for all script files in Rollbar.configure, f.e.:

Rollbar.configure({
  basePath: "file:///private/var/mobile/Containers/Bundle/Application/9A5697CB-45C3-46A6-9A97-4EC7A088CDC7/CordovaSample.app/www/"
})

This way, I would be able to upload sourcemaps by just setting minified_url to /js/app.js, instead of the full URL (and I wouldn't need to upload them more than once if there's one file having many URLs).

Would you mind adding such a feature? Do you have any idea if I could accomplish it right now with some kind of hack, changing the JSON payload before sending to rollbar, or something?

Bower support

Packaging the Rollbar code into the base JS code is useful, for mobile clients (especially) and for desktop clients too.

Although this works already — and it's great that you provide the source on Github in addition the the CDN file — Bower support would make it easier.

With Bower you can still use your Github repo for distribution (similar to how Ruby gems can point to a repo).

http://bower.io/
https://github.com/bower/bower

Using Rollbar.configure in AMD does not initiate queue processing

When initiating Rollbar in an AMD environment, I have been using the following call (per the rollbar.com docs):

Rollbar.configure({
    accessToken: '123abc',
    captureUncaught: true,
    environment: "local"
});

However, I noticed this was never actually sending any logs back to rollbar.com and the queue was never being processed. Upon further investigation, I found that calling Rollbar.init with the same config object (it's required) as an argument actually started the queue processing timer.

I'm not sure if this is an oversight in the code or the docs, but I think it would save future headaches if fixed in one of these places.

Context for Rollbar.wrap

It'd be great to be able to pass context along with exceptions thrown in functions wrapped by Rollbar.wrap, as can be done with Rollbar.log and variants. A concrete use case would be passing details about a jQuery event along with its wrapped handler.

It may also make sense to allow a custom message/callback as with Rollbar.log, but the context object seems like the most useful to support.

DOMException are not reported correctly

In Firefox, notifier.log(ex) does not work for DOMException.

This is the problem:

} else if (arg instanceof Error || arg.prototype === Error.prototype || arg.hasOwnProperty('stack')) {
err = arg;
} else {
custom = arg;
}

I had to bypass the arguments detection code with this direct call:

rollbar._log("error", "", ex);


Without this I was getting alerts with no stacktrace in the dashboard... :-(

Implement batch sending a collection of items

The Rollbar PHP library allows sending a batch of items to Rollbar via the item_batch API endpoint (btw, does this endpoint exist in the API docs?). For more frequent error reporting (via warn() or info()) the number of requests to Rollbar quickly adds up.

A queue that stores up items until a certain latency and then bulk sends the items would be a very nice improvement and allow us to implement Rollbar reporting more thoroughly throughout our app.

Better support for webpack / browserify

I hit some stumbling blocks while trying to integrate rollbar.js with a webpacked bookmarklet I am creating. Here are some things you could do to make it easier for future users:

  • _rollbarConfig is expected to be global but this isn't documented.
  • shim.js, specifically the loadFull() function, expects to be called before window.load. I don't think this requirement is necessary as all the code does is add the script tag to HEAD, which can happen before or after window.load. If you leave the requirement in, you could document it.
  • in shim.js, init() will short-circuit if the global is already defined, but loadfull() has no such guard, so multiple calls/loads will lead to multiple instances of Rollbar loading.

Ideally, here's what should happen:

  • Create a webpack/browserify-friendly replacement for rollbar-snippet.js that includes all initialization required for rollbar.min.js but doesn't load the script tag. It would be extremely simple since there is no need for a temporary queue of objects because rollbar.js can be loaded immediately with this approach, since it is bundled with the project.
  • Document where rollbar.js can be downloaded so that it can be directly required into the webpack/browserify project.
  • Have a branch in rollbar.js that detects if require/define are defined, and if so, export the Rollbar interface without initializing it. Allow this interface to be configured through a method, not requiring any globals. It would look like this:
var _rollbarConfig = { ... };
var rollbar = require("/path/to/downloaded/rollbar.js");
rollbar.initialize(_rollbarConfig);

_rollbarConfig IE8 Error

Hi,

The new script for Browser JS are not working on IE8 browser and our app cannot load.

var k="//d37gvrvc0wt4s1.cloudfront.net/js/v1.0/rollbar.min.js";
_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||k; // This line gets error on IE8.
var l=c.init(a,_rollbarConfig);

windows 7 ie8 running
windows 7 ie8 running

Make sourceMapUrl available in the config instead of using a comment.

According to the docs:

NOTE: if using the sourceMappingURL method, you will need to add this comment manually to the bottom of the generated minified file, as Closure Compiler doesn't provide a way to do this automatically.

What you can do is:

Example from:
https://github.com/closureplease/grunt-closure-tools

output_wrapper: '"(function(){%output%}).call(this); // comment that shouldn't be manually inserted"'

which will add the comment there.

If anyone knows how to do this with uglify it might be helpful to comment on this with an example of how.

Just found out for Browserify, you cannot output a sourcemap file but this can extract sourceMaps:
https://github.com/thlorenz/mold-source-map/blob/master/examples/browserify-external-map-file.js

Ideally, I would rather this option available in the config:

var _rollbarConfig = {
    accessToken: "053632578b2b4aa6968b166a0c10dbca",
    captureUncaught: true,
    sourceMap: {{ STATIC_URL }}/js/sourceMap-{{ GIT_TAG }}.map
  };

Or take the existing source maps inside the js file generated by Browserify.

add rollbar.commonjs.js to npm (+ UMD)

Be nice to be able to add it to a package.json file. Unless I'm mistaken, one is currently required to manually download and keep updated.

Also, any reason not to UMD it and just have 1 dist?

Thanks!

If err.stack can't be parsed, the reported stack trace is not helpful

If you do the following:

var err = new Error("hello");
err.stack = "not a valid stack";
Rollbar.error(err);

Then it will appear in Rollbar like this: https://rollbar.com/Rollbar/ember-example/items/3/ (public link)

This appears to be happening because if TraceKit (which we use to parse the stack trace) can't parse the stack, it uses the current stack trace instead... but this isn't very helpful. Instead, rollbar.js should:

  • include the raw value of err.stack (i.e. the original stack string from the browser, or in the example above where it's clobbered, the string "not a valid stack")
  • include a note about how it couldn't be parsed

match Exception

var errClassMatch = errMsg.match(ERR_CLASS_REGEXP);

If errMsg is jQuery.Event() then TypeError: Object # has no method 'match'

Default level should be overridable

If I configure rollbar with a default level, then setting a different level doesn't work:

_rollbar = ['token', {level: 'error'}];

_rollbar.push({level: 'info', message: 'This should be an info message'});

IE11 stack traces not handled properly

From @altano (issue #27):

It might be worth noting that computeStackTraceFromStackProp() doesn't work in IE11, even though IE totally supports the .stack property. The regular expressions appear to only be written for Firefox and Chrome. Since the stack gets computed by the fallback method, I don't care, but I thought I'd just bring it to your attention.

Bug in Instrumenting jQuery snippet

Hi,

There is a bug in the jQuery snippet from the rollbar website. The issue is the way it's storing the orginal and wrapped event handler callback functions in the a object (see below), for the .on() and .off() replacements.

It can get into a state where rollbar is removing the wrong callback when calling .off() if the functions signatures are the same despite being different functions. This is because browsers are storing the functions as strings when they are being used as keys in the a object. See http://stackoverflow.com/questions/10858632/are-functions-valid-keys-for-javascript-object-properties for reference.

Consider the following code:

    // Variable to store result;
    var result;

    // Create an element
    var $div = $("<div></div>");

    // Create a callback function creator
    var makeCallback = function(number){
        return function(){result = number};
    }

    // Create two seperate callback functions.
    var func1 = makeCallback(1);
    var func2 = makeCallback(2);

    // This returns true, despite them being completely different functions
    // that have the same signature.
    console.log(func1.toString() === func2.toString());

    // Add the first event handler to the click
    $div.on('click',func1);

    // Add the second event handler to the click
    $div.on('click',func2);


    // Remove the first event handler from the click
    $div.off('click', func1);        

    // Trigger the click event
    $div.trigger('click');

    // Expect the result to equal the second callback that should still
    // be attached.
    console.log(result) // should equal 2.

When rollbar is enabled, result ends up being 1. This is because when the second event handler is added, the function signature is the same as the first and so it overwrites the first one in the a object. This is causing the second event handler to be removed when .off() is called with the first event handler callback.

Also (without actually testing it), the .off() code looks a bit sketchy as it looks like it's setting n to a[n] which is the wrapped function and then trying to delete a[n] where n is now the wrapped function that is a non existant key in the a object. But I haven't confirmed this and it could be the obsfucator doing magic.

For reference here is the piece of code I'm referring to (expanded):

    var a={};
    var l=r.fn.on;
    r.fn.on=function(r,e,o,u,f){
        var i=function(r){
            var e=function(){
                try{
                    return r.apply(this,arguments)
                }catch(e){
                    n._rollbar.push(e);
                    t(e);
                    return null
                }
            };
            a[r]=e;
            return e
        };
        if(e&&typeof e==="function"){
            e=i(e)
        }else if(o&&typeof o==="function"){
            o=i(o)
        }else if(u&&typeof u==="function"){
            u=i(u)
        }
        return l.call(this,r,e,o,u,f)
    };

    var f=r.fn.off;
    r.fn.off=function(r,n,e){
        if(n&&typeof n==="function"){
            n=a[n];delete a[n]
        }else{
            e=a[e];delete a[e]
        }
        return f.call(this,r,n,e)
    }

For reference here is a mocha test that fails with rollbar enabled:

    it("should call the second attached callback", function(){
        // Variable to store result;
        var result;

        // Create an element
        var $div = $("<div></div>");

        // Create a callback function creator
        var makeCallback = function(number){
            return function(){result = number};
        }

        // Create two seperate callback functions.
        var func1 = makeCallback(1);
        var func2 = makeCallback(2);

        // This returns true, despite them being completely different functions
        // that have the same signature.
        // console.log(func1.toString() === func2.toString());

        // Add the first event handler to the click
        $div.on('click',func1);

        // Add the second event handler to the click
        $div.on('click',func2);


        // Remove the first event handler from the click
        $div.off('click', func1);        

        // Trigger the click event
        $div.trigger('click');

        // Expect the result to equal the second callback that should still
        // be attached.
        expect(result).to.equal(2);
    });    

v1.1/rollbar.commonjs.min.js is 404

From the browserify example: https://github.com/rollbar/rollbar.js/blob/master/examples/browserify/README.md

GET http://d37gvrvc0wt4s1.cloudfront.net/js/v1.1/rollbar.commonjs.min.js

HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: nginx/1.6.0
Date: Wed, 23 Jul 2014 17:29:46 GMT
Content-Encoding: gzip
Age: 108
X-Cache: Error from cloudfront
Via: 1.1 dcfcb68e46a62263f499518256425d27.cloudfront.net (CloudFront)
X-Amz-Cf-Id: ERjJe2KKq7DRo08ewd732ybfS0pjh7OucISJ1HI9SsvfdZ1YJ4wYAA==

unknown traceback

We are having this kind of traceback in our app:

TypeError: Cannot read property 'indexOf' of undefined
1 File "(unknown)" line (unknown) in [anonymous]
2 File "(unknown)" line (unknown) in [anonymous]
3 File "(unknown)" line (unknown) in [anonymous]
4 File "(unknown)" line (unknown) in [anonymous]

We have Rollbar configured to send additional info (user.id, user.email...) and for some ocurrences in this item that info is empty. But, what drew special attention for us, is the low runtime_ms, about 15 miliseconds, so we think that maybe it is related with some expection inside Rollbar code, make sense?

We have also noted these items began to appear at 6th February, date we think it matches with a new version of Rollbar code (v.1.2.0), however we didn't update rollbar snippet that day but a few days later.

Distribute named-amd (in addition to amd)

Thanks for 1.1.16, much appreciated! ⛵ It's easier to plug Rollbar into larger applications now, where one need control over initialization.

This suggestion (named AMD) makes it possible to import the rollbar library into e.g. Ember.js, and a few other frameworks where named modules are used. Plays well with ES6 modules too.

I've got it working by making two manual adjustments to your current amd dist:

  1. Change the top line to define('rollbar', ['exports'], function(exports) {
  2. Change the bottom line to exports.init = wrapper.init; [alt. you could replace wrapper with exports directly]

Your adjustment may be slightly different, these two points are only to highlight that this should be a relatively easy change.

Here is an example of a library that exports a plain amd and a named-amd (for reference):
https://github.com/instructure/ic-ajax/tree/master/dist

More on AMD:
http://requirejs.org/docs/whyamd.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.