CORS error on Maker API

Not sure if anything has changed in Maker API in the last release or two? But all GETs from my custom dashboard are failing now. No errors in the logs.

Hi @bravenel

Additional detail regarding the Maker API GET failures noted above. They've been working fine but are now failing. They are executed from an rPi on my LAN.

Here is an example of the code initiating a GET to the Maker API....nothing special....just a simple GET then some code to decipher the JSON and change the banner image src on the dashboard to reflect the mode. It's been working fine for weeks but now fails with the latest couple of hub updates.

            // example Javscript to check current HE mode
			// ==========================================
			
			function updateMode() {
				
				var responseString = '';
				var xhttp = new XMLHttpRequest();
				xhttp.onreadystatechange = function() {
					if (this.readyState == 4 && this.status == 200) {
						responseString = xhttp.responseText;
						
						var obj = JSON.parse(responseString);
						
						obj.forEach(function(key, index){
							console.log(key.active);
							console.log(key.name);
							alert(index + "." + key.active + "," + key.name);
							alert(key.name);
							
							if (key.active) {
								var myMode = key.name.toString();
								alert("mode is "+myMode);
								document.getElementById("bannerImage").src = "http://192.168.0.185/images/" + myMode + ".jpg";
								
								// store current mode into session data
								localStorage.setItem("Mode", myMode);
								
							}
							
						});
						
					}
					
				};
				
				xhttp.open("GET", "http://192.168.0.167/apps/api/" + myMakerAPI + "/modes?access_token=" + myAccessToken, true);
				xhttp.send();			
				
			};

Errors in the Chrome developer console are:

Actually I always used to get the CORS error message but the GET executed ok and returned the JSON. Now it doesn't execute at all. I've tried dropping the "http://" and just put "192.168.0.185" but I get the same error.

The GET does work ok if pasted into a browser so the set-up is ok I think. But something is preventing the GET executing from the rPi (.185) to the HE hub (.167).

Is the CORS supposed to be working now?
Why the error messages?

Ah, well clearly there is an issue. We are looking into it.

What version of the platform are you on?

And, I was wrong about dropping the http:// or https://

Latest firmware release, C5 hub.
I've tried both with and without the http:// and still get the error message.

1 Like

Unfortunately it doesn't fix my issue. I'm getting the same error message to my developer console on Chrome browser using the simple test code above.

@bcopeland @bravenel any solution please? Shall I log a support ticket?

No ticket necessary.. It is being tested.. Hopefully the patch will be out this morning

2.2.2.127 should fix it .. If you want to try again

After updating to 2.2.2.127, I'm seeing these errors in the log:

EDIT: App:353 is a makerAPI instance.

@bcopeland After updating to 2.2.2.127, I get this error on Node-Red:
image

I re-checked all configurations.

Here's the log:

Thanks for the feedback .. bouncing it back to to the engineer working on the issue

Now I need to remember how to roll back to an earlier version...

Settings Menu, Back and Restore, then the non obvious link at top
image

Thanks, already figured it out.

I was having this same problem, and just upgraded to 2.2.2.129 and it solved my problems too!

3 Likes

I'm away on holiday so will check the fix for my setup when I get back home soon!

1 Like

Just got back from holiday and it looks like the bug is fixed for me. My dashboard is now updating again properly. Thank you!

Now that I'm making more use of Hubitat I need CORS support. When 40 or so endpoints and dynamic addresses I can't maintain a list of all of them. I need a flag that opens up CORS for all my local addresses.