MindscapeHQ / raygun4js

JavaScript provider for Raygun
https://raygun.com
Other
148 stars 60 forks source link

customData become null when using rg4js('withCustomData', {custom: 'data'}); #149

Closed fstendardi closed 8 years ago

fstendardi commented 8 years ago

The use of rg4js('withCustomData', {custom: 'data'}) doesn't work (customData won't be passed during Raygun.send call.

This happens because of this fragment of code:

var onLoadHandler = function () {
    if (apiKey) {
      if (!options) {
        options = {};
      }

      if (enablePulse) {
        options.disablePulse = false;
      }

      options.from = 'onLoad';
      Raygun.init(apiKey, options, null);   //(apiKey, options, customData) <---- origin of bug
    }
...
}

see attached screenshot for the Raygun.init fragment that cause the bug.

customData works fine when using Raygun.send(ex, customData) call.

this is my js configuration

<script type="text/javascript">
  !function(a,b,c,d,e,f,g,h){a.RaygunObject=e,a[e]=a[e]||function(){
  (a[e].o=a[e].o||[]).push(arguments)},f=b.createElement(c),g=b.getElementsByTagName(c)[0],
  f.async=1,f.src=d,g.parentNode.insertBefore(f,g),h=a.onerror,a.onerror=function(b,c,d,f,g){
  h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({
  e:g})}}(window,document,"script","//cdn.raygun.io/raygun4js/raygun.js","rg4js");
</script>

<script type="text/javascript">
    rg4js('apiKey', 'D+J/vczyDriJrfO5t2RG8w==');
    rg4js('enableCrashReporting', true);
    rg4js('options', {
       allowInsecureSubmissions: true
    });

    rg4js('setUser', {
        identifier: 'myid',
        isAnonymous: false,

        uuid: '111111'
});

rg4js('withCustomData', {custom: 'data'});  //this data won't be passed during Raygun.send call

</script>

fotografia_dello_schermo_111715_103159_am

armstrjare commented 8 years ago

I'm also having this problem - no custom data going through

fundead commented 8 years ago

Thanks for the reports, this bug is now fixed and going out in the next release (in the above PR) shortly.