Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nabu Casa error - Remote UI unreachable #30555

Closed
rschuiling opened this issue Jan 7, 2020 · 44 comments · Fixed by #32508
Closed

Nabu Casa error - Remote UI unreachable #30555

rschuiling opened this issue Jan 7, 2020 · 44 comments · Fixed by #32508

Comments

@rschuiling
Copy link

rschuiling commented Jan 7, 2020

Home Assistant release with the issue:
0.103.6

Last working Home Assistant release (if known):
0.103.5

Operating environment (Hass.io/Docker/Windows/etc.):
Hass.io on Ubuntu host

Integration:

Description of problem:
After upgrading to 0.103.6 (from .5) the GUI in unreachable from its Nabu Casa URL. It is still reachable on its DuckDNS url.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

Traceback (if applicable):
Errors in log, persising after Docker restarts:

2020-01-07 19:12:41 ERROR (MainThread) [hass_nabucasa.remote] Can't handle request-connection without backend
2020-01-07 19:12:41 ERROR (MainThread) [hass_nabucasa.iot] Error handling message
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 90, in _async_handle_handler_message
    result = await handler(self.cloud, message["payload"])
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 143, in async_handle_remote_sni
    await cloud.remote.handle_connection_requests(caller_ip)
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 216, in handle_connection_requests
    raise RemoteNotConnected()
hass_nabucasa.remote.RemoteNotConnected

Additional information:
Edit: downgrading to 0.103.5 immediately fixed this issue. Definitely seems to be related to 0.103.6 then.
Edit2: seems it's not related to 0.103.6 after all. Now on 0.103.5, after most HA restarts the remote UI is unreachable for me. Logs are below in the comments.

@probot-home-assistant
Copy link

Hey there @home-assistant/cloud, mind taking a look at this issue as its been labeled with a integration (cloud) you are listed as a codeowner for? Thanks!

@balloob
Copy link
Member

balloob commented Jan 8, 2020

103.6 only made changes to the cloud integration related to Google (https://github.com/home-assistant/home-assistant/pull/30525/files). Do you have any other errors in your logs ?

@fillwe
Copy link

fillwe commented Jan 8, 2020

I have had issues since 103 with remote ui sometimes being unavailable. It comes back at random intervals. Google working fine though. Have started using my own domain for now to see if it solves itself, but seen a couple of people in discord and the forums reporting this

@rschuiling
Copy link
Author

rschuiling commented Jan 8, 2020

@balloob No, this is a full copy-paste of the log after the last restart. The restart before that had some standard warnings about the 'dangers' of custom components (spotcast, afvalwijzer).

Forum topic where some more people are reporting this issue: https://community.home-assistant.io/t/nabu-casa-remote-ui-connection-not-always-available/140300/11

@pvizeli
Copy link
Member

pvizeli commented Jan 8, 2020

I need the full log of startup with debug logging. Otherwise I can't say why the backend was not setup.

@rschuiling
Copy link
Author

rschuiling commented Jan 10, 2020

My issue has changed somewhat: I do not see the nabucasa errors I mentioned in the description. But my front end is unreachable after 50% of the restarts. So I have to restart twice to get into the front-end. Edit: this is not consistent behaviour; right now I can't get the front-end to load through the nabu casa URL at all, not even after 3 restarts. The frontend is reachable through the duckdns URL though.

home-assistant.log

@pvizeli Is this debug log sufficient for you to see what is causing the remote UI not to connect?

@rschuiling rschuiling changed the title [0.103.6] Nabu Casa error - HA unreachable Nabu Casa error - Remote UI unreachable Jan 11, 2020
@rschuiling
Copy link
Author

Is there anything else I can do to help this along?

@pvizeli
Copy link
Member

pvizeli commented Jan 14, 2020

What I see in your log is, that the code is never called like they will not exists. Can you remove the dept folder inside config?

@rschuiling
Copy link
Author

I don't see a dept folder. Do you mean the deps folder? This one is present and empty. Do you want me to remove it? Presently, the remote UI is functioning just fine.

@pvizeli
Copy link
Member

pvizeli commented Jan 20, 2020

Okay. I close the issue and we can try to debug it again if you see the issue 👍

@pvizeli pvizeli closed this as completed Jan 20, 2020
@rschuiling
Copy link
Author

rschuiling commented Jan 24, 2020

@pvizeli Right now; after every restart the Remote UI is unreachable (whereas the .duckdns-URL is reachable at the same time). If I simply wait for a long time (30-60 minutes is my feeling), eventually the remote-UI starts functioning. I am running a trace log right now, waiting for the Remote UI to come up. Would you prefer a new issue or should we continue with this one?

Edit: I have waited for almost two hours this time, the remote UI is still not reachable for me. I can't upload the log here unfortunately, it's too big (50+MB). Do you have any suggestions to pinpoint the issue here?

Edit2: Here are 2 log files:

  1. log where remote UI was unreachable for 2+ hours after restart https://www.dropbox.com/s/2n8i9h2wn7w338j/home-assistant_no_remote_ui_after_2hrs.log?dl=0

  2. log where remote UI was available right after restart
    https://www.dropbox.com/s/gvbno273m8b7tuw/home-assistant_remote_ui_up%20after%20restart.log?dl=0

Can you see a difference? What is the cause that my remote UI URL often is unreachable after restarting?

@jorismocka
Copy link

Hi @pvizeli
I have exactly the Same issue @rschuiling is describing.

There are Logs like this:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 90, in _async_handle_handler_message
result = await handler(self.cloud, message["payload"])
File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 143, in async_handle_remote_sni
await cloud.remote.handle_connection_requests(caller_ip)
File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 216, in handle_connection_requests
raise RemoteNotConnected()
hass_nabucasa.remote.RemoteNotConnected

Any Help is appreciated and thanks a Lot for your work! Joris

@jorismocka
Copy link

Here another Log:

Unexpected error processing request for /api/cloud/login
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/cloud/http_api.py", line 129, in error_handler
result = await handler(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 48, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/cloud/http_api.py", line 196, in post
await cloud.login(data["email"], data["password"])
File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/init.py", line 182, in login
await self.start()
File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/init.py", line 240, in start
await self.client.logged_in()
File "/usr/src/homeassistant/homeassistant/components/cloud/client.py", line 121, in logged_in
gconf.async_enable_local_sdk()
File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 205, in async_enable_local_sdk
self.hass, DOMAIN, "Local Support", webhook_id, self._handle_local_webhook,
File "/usr/src/homeassistant/homeassistant/components/webhook/init.py", line 33, in async_register
raise ValueError("Handler is already defined!")
ValueError: Handler is already defined!

@balloob
Copy link
Member

balloob commented Jan 25, 2020

@jorismocka HA version?

@jorismocka
Copy link

jorismocka commented Jan 25, 2020 via email

@rschuiling
Copy link
Author

This really is an issue for me: after most restarts I am unable to use the Remote UI. Can this get some attention? Should I open a new issue for this?

@bramkragten bramkragten reopened this Jan 29, 2020
@pvizeli
Copy link
Member

pvizeli commented Jan 29, 2020

hass_nabucasa.remote.RemoteNotConnected means they was not loaded. The error why is not loaded is in that case the question they we search and should be in the log after start.

@jorismocka yes, the issue with async_enable_local_sdk stop to process the connection and the reason why it not is loaded after start.

@pvizeli
Copy link
Member

pvizeli commented Jan 29, 2020

@rschuiling if the remote does not work, the code was never executed what I can see in your logs. Do you have any kind of custom component running or other modifications? The log output looks like an old version of hass-nabucasa python library.

@jorismocka
Copy link

hass_nabucasa.remote.RemoteNotConnected means they was not loaded. The error why is not loaded is in that case the question they we search and should be in the log after start.

@jorismocka yes, the issue with async_enable_local_sdk stop to process the connection and the reason why it not is loaded after start.

@pvizeli thank you for reopening this issue. It really prevents me from restarting my hass.io because I'm afraid to loose my remote access. What is async_enable_local_sdk part of? Code of the Remote UI? Or a third party tool? Thanks a lot.

@rschuiling
Copy link
Author

@pvizeli I am running Hass.io on Ubuntu, HA 0.103.5 with Hass.io supervisor v195. My custom components are HACS (0.20.8 = latest), Spotcast (2.6.1 = latest), Afvalwijzer (3.0.12 = not latest).

The remote UI issue occurs in 0.103.6 and 0.103.5. How can I upgrade to the newest version of hass-nabucasa python library? Upgrading HA?

@fillwe
Copy link

fillwe commented Feb 2, 2020

As i mentioned earlier i am having the same issues. I am also running Hass.io on Ubuntu, HA 0.104.3 with Hass.io supervisor v195. My custom components are HACS (0.20.9 = latest), Amazon Rekognition 103, Krisinformation 95fe9d2, Unifi Gateway v0.2.3. Have tried uninstalling them all as well as Custom header and card tools. The remote UI problems started for me after 102. Should i provide som logs as well?

@pvizeli
Copy link
Member

pvizeli commented Feb 3, 2020

If you said after restart. Do you means after restart the core or the full device?

@fillwe yes but I need only the log (debug) from hass_nabucasa. all other is not needed. So I can verify if it is the same issue as @rschuiling. Please provide also the ouput of hassio info.

@jorismocka
Copy link

If I perform an "hassio ha restart" on CLI - not if I'm restarting the whole device.
In the mean time I upgraded to 0.104.3 and the error did not occur until now!

@rschuiling
Copy link
Author

I also mean a restart of core HA. I also restarted the device (Ubuntu) once, but that didn't make any difference for the issue.

@MichielvanBeers
Copy link

MichielvanBeers commented Feb 4, 2020

Hi,

I'm experiencing the same issue: after reboot the whole system the remote connection is unreachable for quite some time. I've also contacted support about this, but thusfar we haven't been able to solve it.
In my configuration Nabu Casa starts working again when I disable Amazon Polly TTS. Are more people here using that integration?

I'm on Hass 0.104.1 BTW.

@rschuiling
Copy link
Author

rschuiling commented Feb 4, 2020

I am indeed using Amazon Polly. Will try if disabling it soon.

@jorismocka
Copy link

I'm not using Amazon Polly TTS just builtin Google TTS.

@balloob
Copy link
Member

balloob commented Feb 5, 2020

For people chiming in on this issue that they also experience this, we need logs or we can't determine the issue.

@MichielvanBeers
Copy link

MichielvanBeers commented Feb 6, 2020

Ah of course, my apologies.

Home Assistant release with the issue:: 0.103.5 & 0.104.3

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io on Raspberry Pi 3

I'm in touch with the Nabu Casa support team. They recommended to match my AWS server option with the Nabu Casa one, changing it from eu-west-3 to eu-central-1. This made the connection sometimes work as normal, but most of the time it was still unable to connect.

Log file when remote UI is not available

ps Sorry for the crappy lay-out. I've copy pasted this from the e-mail conversation with the Nabu Casa support, since I don't have the most recent logs at hand anymore.

Error handling message
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 90, in _async_handle_handler_message
    result = await handler(self.cloud, message["payload"])
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot.py", line 143, in async_handle_remote_sni
    await cloud.remote.handle_connection_requests(caller_ip)
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/remote.py", line 216, in handle_connection_requests
    raise RemoteNotConnected()
hass_nabucasa.remote.RemoteNotConnected

Can't handle request-connection without backend

Log when remote UI is available

Unexpected error
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot_base.py", line 108, in connect
    await self._handle_connection()
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/iot_base.py", line 147, in _handle_connection
    await self.cloud.auth.async_check_token()
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/auth.py", line 145, in async_check_token
    await self.cloud.run_executor(self._check_token)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/auth.py", line 160, in _check_token
    access_token=self.cloud.access_token, refresh_token=self.cloud.refresh_token
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/auth.py", line 217, in _cognito
    **kwargs,
  File "/usr/local/lib/python3.7/site-packages/warrant/__init__.py", line 172, in __init__
    self.client = boto3.client('cognito-idp', **boto3_client_kwargs)
  File "/usr/local/lib/python3.7/site-packages/boto3/__init__.py", line 91, in client
    return _get_default_session().client(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/boto3/session.py", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/usr/local/lib/python3.7/site-packages/botocore/session.py", line 827, in create_client
    credentials = self.get_credentials()
  File "/usr/local/lib/python3.7/site-packages/botocore/session.py", line 426, in get_credentials
    'credential_provider').load_credentials()
  File "/usr/local/lib/python3.7/site-packages/botocore/session.py", line 907, in get_component
    del self._deferred[name]
KeyError: 'credential_provider'

@cogneato
Copy link

cogneato commented Feb 6, 2020

@MichielvanBeers

Can you (and anyone else) change the logger: integration as shown here?

logger:
  default: info
  logs:
    hass_nabucasa: debug
    snitun: debug
    homeassistant.components.cloud: debug
    homeassistant.components.cloud.iot: debug

@MichielvanBeers
Copy link

MichielvanBeers commented Feb 7, 2020

@cogneato

I already had my logger set to that configuration. So the logs you see above, is the info that was logged when I changed my settings to yours. Let me know if I can do anything else.

@Larry0ua
Copy link

Also experience the connection problem to Remote UI. Though that that is a limitation of trial period, but looks like there is some issue.
Yesterday and day before yesterday there were power failures in my place, and after device running HA was online again it never appeared connected via nabu.casa URL. Actually when I tried to open the remote UI from HASS application on Android it suggested me to open my profile on nabu.casa and click "Connect" for Remote UI. After this the Remote UI is back online.

From my understanding it means that nabu.casa somehow knows where my local instance is running but it is not linked to nabu.casa URL after restart and should be manually re-connected.

@fillwe
Copy link

fillwe commented Feb 13, 2020

Moved my installation from Docker on Ubuntu to a vm in proxmox, have not had any issues since moving. Starting to think this is a Ubuntu host related issue

@rschuiling
Copy link
Author

@MichielvanBeers Amazon Polly doesn't seem to be the culprit. I did several tests where Polly was disabled and enabled. Here are two logs, in both cases Amazon Polly was enabled in configuration.yaml:

home-assistant1.log - Remote UI was unreachable after restart
home-assistant2.log - Remote UI was available after restart, straight away

@cogneato These logs are with your recommended logging options. Anything I can try to help find this issue?

@codylv7
Copy link

codylv7 commented Feb 21, 2020

I am experiencing this issue as well, working on getting logs..

@codylv7
Copy link

codylv7 commented Feb 22, 2020

Here's a log for you https://pastebin.com/DmLDuxML

Let me know what else I can provide

If I set ssl_profile: intermediate the error does not occur, so something SSL related

@balloob
Copy link
Member

balloob commented Feb 25, 2020

Traced it down to boto/boto3#1592 . It seems like it's related to having other threads also use the AWS SDK. Looks like boto/boto3#1592 (comment) might be a solution.

@MichielvanBeers
Copy link

Thanks for the update @balloob! I'm not completely sure how I can implement this fix myself though.. Could you maybe give me a pointer on if and how I can implement this fix?

@balloob
Copy link
Member

balloob commented Feb 26, 2020

We need to implement the fix in the code.

@codylv7
Copy link

codylv7 commented Mar 5, 2020

Awesome, thank you for working on a fix!

@ryanm7780
Copy link

Awesome. This has been plaguing me. I'm really looking forward to the fix being released. Thanks @balloob !

@MichielvanBeers
Copy link

That is great news! Very happy to hear that there is a fix :) thanks a lot!

@josedeone
Copy link

hello guys
i been having the same issue after a reboot nabu kasa SSL goes down. Is there a fix for this coming soon?? ill be posting log later tonight

@balloob
Copy link
Member

balloob commented Oct 24, 2020

Please create a new issue. This issue has been resolved.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Oct 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.