iCloud Binding Communication Error

I can confirm the same problem. Bundle 3.4.0 snapshot #3046. It was at least 6 days okay now before this unreliability returned.

Same problem here, using Binding version: 3.4.0.202207121439 right after reinstalling to get rid of the communication error. Restart did not help.

I am having the same Problem. Why is this icloud binding not working stably?

Why is it always the binding to be blamed. Ever thought that the issue might be on iCloud side ?

There have be no changes to the binding since last fix (which was not really a binding but an issue on icloud side).

@hmerk Please don‘t take this personally! Most Users just see the error in the Bridge Thing or in the log! I am not blaming the binding and I appreciate all the hard work you guys do!

As the icloud-service on Apple-side doesn’t show any problems, this here is the only place most users know to inform about the problem…

1 Like

@Flip I don’t take this personally, but see “complaints” many times, which result in an issue outside of openHAB.
As somebody already mentioned before, most systems are no longer interfacing with the iCloud FindMyDevice service but use the web interface, there must be a reason for this.
Unfortunately, nobody is volunteering to make those changes to the openHAB iCloid Binding, which in fact would result in a complete new binding.

1 Like

The iCloud-Binding is an official OpenHAB-Binding.

So far I have assumed that it is ok to report errors when they are noticed.

For me as a user, it is not clear whether a change from Apple only requires a small change in the binding or whether there are major problems.

The fact that a binding (as you write) actually needs a complete new development is also not recognizable for a user.

If a binding has an orphan status because it no longer works (for whatever reason - e.g. because there is no longer a developer for it) then users should be informed accordingly.

Anyway, I don’t think it’s ok that users get rejected when they report a Problem!

1 Like

Same problem here. Same error as in post:

openHAB 3.3 with openHABian.

Absolutely, but we have to find the reason for those errors.

That’s not what I wrote, we should sonsider a rewrite, but therefore we need a volunteer developer.

Nobordy said there is nor developer fixing issues, as you can see with latest fix.

Also not what I wrote

ok,
@wborn, @hilbrand, @hmerk

have someone of you chance and time to take a look, why the authentication-header doesn’t work anymore in this binding ?

It seems, that there is a modification of the binding necessary.

Thank you very much.

Ralph

1 Like

I have created an issue:

[iCloud] Bridge-Thing generates Communication Error · Issue #13282 · openhab/openhab-addons (github.com)

2 Likes

Sorry Ralph, but this is above my skills.

1 Like

This is also way above my skillset. But let’s try to break this error down. The exception indicates that it is thrown by “org.eclipse.jetty.client”. Isn’t the jetty client part of the base Eclipse code…the foundation that openHAB is built on? This was my first clue that it might not specifically be a binding issue, but maybe something odd about the response from iCloud. I mentioned this possibility a week or so ago.

Someone on GitHub pointed to THIS issue that was opened in a repo that provides a wrapper for the jetty HttpClient. The were seeing the exact same error thrown by the Jetty HttpClient. The responses to that open issue appear to indicate that the issue is in fact that the server’s response (in this case Apple’s iCloud server) is invalid because it doesn’t follow the standard that the jetty HttpClient expects. The HttpClient is expecting a “WWW-Authenticate header” when the server issues an authentication challenge, but iCloud isn’t providing that header in the response.

So how do we fix this? The only ideas I can come up with are:

  1. Ask Apple to fix the iCloud server response to include the “WWW-Authenticate header”. I imagine this will unlikely change.
  2. Modify the Jetty HttpClient class to not expect the “WWW-Authenticate header” - probably not going to happen either. Standards are created for a reason and we shouldn’t be in the business of modifying those standards to accommodate bad practices.
  3. Modify the portion of the iCloud binding that calls/interacts with Jetty’s HttpClient class to not expect the “WWW-Authenticate header”. I’m not sure if this is even possible, but it it were, it seems like a reasonable approach. I’ll continue to scrub through the binding code but, as I’m a SQL developer, this is all extremely foreign to me.
  4. Refactor the code to remove the dependency on the Jetty HttpClient class and replace it with an alternative http class that doesn’t have such restrictions, or handle all of the http methods natively in the binding - I also have no idea how to accomplish this, but it seems possible and might be the only real option we have.

Alternative suggestions are welcome!

2 Likes

Thanks @peteraquino for this analysis.
The stange thing is, that the erro seems not to occur on all request, but only someties.

  1. Modify the portion of the iCloud binding that calls/interacts with Jetty’s HttpClient class to not expect the “WWW-Authenticate header”. I’m not sure if this is even possible, but it it were, it seems like a reasonable approach. I’ll continue to scrub through the binding code but, as I’m a SQL developer, this is all extremely foreign to me.

Perhaps this hint is useable ?

Reopen Previous issue: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header · Issue #33 · jetty-project/jetty-reactive-httpclient (github.com)

in this tread, they have removed the WWW-Authenticate-Header from the jetty-request (if I understand it right)

Yes, but with more and more errors and less successful request. Until yesterday I had a 50/50 chance for a success so later updates were ok. But now 100% errors.

Maybe a load balancer on apple side now rollout of an update Server by server?

Here 100% failed requests too… Unfortunately I failed already on the Eclipse installation - so it’s definitely above my skills too. Meanwhile I tried to setup some rules based upon pyicloud (which is working fine) but it’s a long way to go until it can replace the binding…

I dug a little deeper into this. The problem is that the iCloud binding doesn’t actually call the class directly. It’s buried a few levels deep in various wrappers that openHAB provides. The specific class that the binding uses is “org.openhab.core.io.net.http.HttpRequestBuilder”. The fix from that other post requires options that don’t appear to be exposed in the HttpRequestBuilder class.

I was having the same issues as others have recently reported regarding WWW-Authenticate-Header. Out of the blue the iCloud Account Thing just went Online and seems to be working for me. Given that this started working without any change in my code or my setup, it leads me to believe this was an Apple Server issue and has been resolved, for now at least.

Same here. My iCloud account thing has been down continuously for several days and just miraculously started working this afternoon. No changes in my setup.