CORS error on Maker API

@bravenel Can you assist on this please:

Why am I getting this error on the eventsocket...

2020-07-20 12_09_22-192.168.0.185_index.htm#close

... if the CORS is set as below?

Remove the "http://", so that it is just the ip address. The example is wrong. We will correct that.

1 Like

Ah ok, thank you very much.

And it's now possible to put 2 ip addresses in? This was not working before I recall although maybe due to the same addressing issue.

Still getting the same error.
What's the reference to 127.0.0.1 ? Does that provide a clue to the issue?

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.