Meteor works in Chrome but not in Firefox and IE


#1

Hi,

there is something strange going on. My client side works perfectly in chrome, but not in firefox or Edge. in these browsers I get this error.

I am only doing a isAlive test: I try if I can make a rest get call to external API. (getStreams), if I get an answer back, I now the other system is ALIVE. So if I make the call server side and no error, then I present a succes message:

Template.layout.onRendered(function() {
  // const instance = this;
  // instance.connection = new ReactiveVar();
  console.log('UI HELPER: Check if we have a connection to Sense?');
  Meteor.call('getStreams', (error, result) => {
    if (error) {      
      console.error(error);
      Session.set('NoSenseConnection', true);
      sAlert.error("We can't connect to Qlik Sense, is sense running, virtual proxy configured?");
    } else {
      var message = "Connected to Qlik Sense via the REST API's, we have tested this by requesting the list of streams via the QRS REST API."; 
      console.log(message);
      sAlert.info(message);
      Session.set('NoSenseConnection', false);
    }
  });
});

the server side

export function getStreams() {    
    try {          
        const result = HTTP.get('http://' + senseConfig.host + '/' + senseConfig.virtualProxy + '/qrs/stream/full', {
            headers: authHeaders,
            params: { 'xrfkey': senseConfig.xrfkey }            
        })
        return result.data;
    } catch (err) {
        throw new Meteor.Error('getStreams failed', err.message);
    }
};

The error I only get in firefox and IE: (could it be that they can’t handle the arrow function, or that it times out to quick?)

Setup generic helper functions, for functions every template needs app.js:819:5
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create modules.js:21461:3
UI HELPER: Check if we have a connection to Sense? app.js:1249:3
client generation helper: get app table, the config used to generate the URLs to Sense:  Object { host: "2008ENT", port: 80, virtualProxyClientUsage: "meteor", UDC: "2008ENT" } app.js:969:13
Object { stack: "Meteor.makeErrorType/errorClass@htt…", error: "getStreams failed", reason: "Cannot read property 'name' of null", details: undefined, message: "Cannot read property 'name' of null…", errorType: "Meteor.Error" } app.js:1252:7
require<.imports.ui["layout.js"]</</<() app.js:1252
Meteor.bindEnvironment/<() meteor.js:1105
._maybeInvokeCallback() ddp-client.js:3557
.receiveResult() ddp-client.js:3577
._livedata_result() ddp-client.js:4736
Connection/onMessage() ddp-client.js:3385
._launchConnection/self.socket.onmessage/<() ddp-client.js:2736
_.forEach() underscore.js:149
._launchConnection/self.socket.onmessage() ddp-client.js:2735
REventTarget.prototype.dispatchEvent() ddp-client.js:175
SockJS.prototype._dispatchMessage() ddp-client.js:1160
SockJS.prototype._didMessage() ddp-client.js:1218
SockJS.websocket/that.ws.onmessage() ddp-client.js:1365

The error pops up apparently in my onRendered:


#2

So the issue arises by my own bad code, but why the difference in the browser?

This was the wrong part: call.createdBy = Meteor.user().name

import { Mongo } from 'meteor/mongo';

export const APILogs = new Mongo.Collection('apiLogs');

export function REST_Log(call){
   call.createDate = new Date()
   // call.createdBy = Meteor.user().name;
   APILogs.insert(call);

}