All of a suddenly XMLHttpRequest is not defined

Yesterday i upgraded to 0.29.0, verified that the app worked and moved on working on it. When i start again today i all of a sudden get lots of XMLHttpRequest is not defined errors.

I am fairly sure that this worked yesterday when i stopped working on the app, and there have been no changes to the codebase from that point.

The error

OG: Error: JavaScript error in Main.js line 291: Name: ReferenceError: XMLHttpRequest is not defined
    Error message: Uncaught ReferenceError: XMLHttpRequest is not defined
    File name: Main.js
    Line number: 291
    Source line:   var Request = new XMLHttpRequest();
    JS stack trace: ReferenceError: XMLHttpRequest is not defined
        at LoadMapMarkers (Main.js:291:21)
        at LoadDealMap (Main.js:284:3)
        at RouteToMain (Main.js:400:3)
        at InitApp (Main.js:407:5)
        at null._tempMethod (Main.js:415:1)
     in Fuse.Reactive.JavaScript</usr/local/share/uno/Packages/Fuse.Reactive/0.40.8/$.uno:1445>

Code that flops:

function LoadMapMarkers(args){

  var Request = new XMLHttpRequest();
  Request.open("POST", MAPLIST_API_ENDPOINT, true);
  Request.setRequestHeader("Content-Type", "application/json");
  Request.setRequestHeader("Expect", "");
  Request.onreadystatechange = function() {
    if (Request.readyState == 4 && Request.status == 200) {
      var Response = [JSON.parse(Request.responseText)];
      if(Response){

        MapMarkers.value = Response[0];

        for (var i = 0; i < MapMarkers.value.Locations.length; i++) {
          console.log(JSON.stringify(MapMarkers.value.Locations[i].Colour));

          if(MapMarkers.value.Locations[i].Colour === "Blue"){
            MapMarkers.value.Locations[i].Colour = "Point_Blue.png";
          }

        }

        console.log(JSON.stringify(MapMarkers));
      }
      else if (resp.Error) {
      }
    }
  }
  Request.send('{"PartnerID":"123","Token":"123", "Lng" : "123", "Lat" : "123"}');
}

Running on a Mac Mini Late 2012 (2.4GHz i5, 4GB ram) with macOS Sierra (10.12.1)

Thanks for the report Krister! Someone who knows more about this will get back to you to get to the bottom of this, but in the mean time: Does uno clean help?

uno clean doesn’t fix it. Tried several times.

Could you create a new project and try to reproduce it with as small amount of code as possible?

Placing the exact same code-snippet into the default Fuse TestProject works.

Any suggestions on how to get it to work again in my main-project?

Try to comment out code until you are left with the faulting code. It’s probably something with how you include or split up your JS files or wrong references in project file.

Tried that for a while already. The simplest solution for me was to just write the app all over again…

On the plus side that gave me the chance to replace xmlHttpRequest with Fetch :wink: