ludeeus/integration_blueprint

Opening the url in the browser crashes HA due to an openssl issue

aad4 opened this issue · 2 comments

aad4 commented

System Health details

The system health cannot be provided, because opening the HA url in the browser generates an error.

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

Opening the url reported back by VSCode when running scripts/develop in the dev container will crash HA, with an error message in the browser and on the command line where I started HA (scripts/develop).

Reproduction steps

  1. Clone the repo
  2. Open it in VSCode
  3. Build and open in dev container
  4. Building of the container does not show issues
  5. The postCreateCommand (scripts/setup) also runs fine
  6. Starting HA via scripts/develop seems to be ok
  7. But when opening the HA url in the browser will produce an error (both in the browser and in the command line where the script was started.

In one of the trials I saw an error message that OpenSSL version was incompatible, but I can no longer get it to show.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. pyopenssl 23.0.0 requires cryptography<40,>=38.0.0, but you have cryptography 35.0.0 which is incompatible.

Debug logs

Logs in the console window:
==========================

2023-03-31 16:42:09 DEBUG (MainThread) [asyncio] <Server sockets=(<asyncio.TransportSocket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 8123)>, <asyncio.TransportSocket fd=12, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('::', 8123, 0, 0)>)> got a new connection from ('127.0.0.1', 50248): <socket.socket fd=14, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 8123), raddr=('127.0.0.1', 50248)>
2023-03-31 16:42:09 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/homeassistant/components/http/forwarded.py", line 80, in forwarded_middleware
    from hass_nabucasa import (  # pylint: disable=import-outside-toplevel
  File "/home/vscode/.local/lib/python3.10/site-packages/hass_nabucasa/__init__.py", line 15, in <module>
    from .auth import CloudError, CognitoAuth
  File "/home/vscode/.local/lib/python3.10/site-packages/hass_nabucasa/auth.py", line 7, in <module>
    import boto3
  File "/home/vscode/.local/lib/python3.10/site-packages/boto3/__init__.py", line 17, in <module>
    from boto3.session import Session
  File "/home/vscode/.local/lib/python3.10/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/client.py", line 15, in <module>
    from botocore import waiter, xform_name
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/client.py", line 17, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/utils.py", line 37, in <module>
    import botocore.httpsession
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/httpsession.py", line 46, in <module>
    from urllib3.contrib.pyopenssl import (
  File "/home/vscode/.local/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.crypto
  File "/home/vscode/.local/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/home/vscode/.local/lib/python3.10/site-packages/OpenSSL/SSL.py", line 19, in <module>
    from OpenSSL.crypto import (
  File "/home/vscode/.local/lib/python3.10/site-packages/OpenSSL/crypto.py", line 3258, in <module>
    utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'


Browser response page with the error:
====================================
500 Internal Server Error
Traceback:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/home/vscode/.local/lib/python3.10/site-packages/homeassistant/components/http/forwarded.py", line 80, in forwarded_middleware
    from hass_nabucasa import (  # pylint: disable=import-outside-toplevel
  File "/home/vscode/.local/lib/python3.10/site-packages/hass_nabucasa/__init__.py", line 15, in <module>
    from .auth import CloudError, CognitoAuth
  File "/home/vscode/.local/lib/python3.10/site-packages/hass_nabucasa/auth.py", line 7, in <module>
    import boto3
  File "/home/vscode/.local/lib/python3.10/site-packages/boto3/__init__.py", line 17, in <module>
    from boto3.session import Session
  File "/home/vscode/.local/lib/python3.10/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/client.py", line 15, in <module>
    from botocore import waiter, xform_name
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/client.py", line 17, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/utils.py", line 37, in <module>
    import botocore.httpsession
  File "/home/vscode/.local/lib/python3.10/site-packages/botocore/httpsession.py", line 46, in <module>
    from urllib3.contrib.pyopenssl import (
  File "/home/vscode/.local/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.crypto
  File "/home/vscode/.local/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/home/vscode/.local/lib/python3.10/site-packages/OpenSSL/SSL.py", line 19, in <module>
    from OpenSSL.crypto import (
  File "/home/vscode/.local/lib/python3.10/site-packages/OpenSSL/crypto.py", line 3258, in <module>
    utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'

Diagnostics dump

Again, as I cannot get to the HA UI, I cannot share the diagnostics dump.

aad4 commented

By adapting dependencies in requirements.txt for homeassistant (and pip because of the changed ha dependency), I could get the dev container to work properly.

A working requirements.txt:

colorlog==6.7.0
homeassistant==2023.3.6
pip>=21.0,<23.1
ruff==0.0.259

Should I make a pull request for that?

I just made a pull request that happens to have fixed this.

#97