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

Unable to setup Matrix component #53218

Closed
johansmitsnl opened this issue Jul 20, 2021 · 10 comments
Closed

Unable to setup Matrix component #53218

johansmitsnl opened this issue Jul 20, 2021 · 10 comments

Comments

@johansmitsnl
Copy link
Contributor

The problem

Unable to setup a connection to the Matrix home server.

What is version of Home Assistant Core has the issue?

2021.7.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Matrix

Link to integration documentation on our website

https://www.home-assistant.io/integrations/matrix/

Example YAML snippet

# Config
matrix:
  homeserver: https://smitsmail.net
  verify_ssl: true
  username: "@ha:smitsmail.net"
  password: !secret ha-s01_password

notify:
  - name: matrix_johan_smits
    platform: matrix
    default_room: "!UrnewXXXXXXXX:smitsmail.net"

Anything in the logs that might be useful for us?

Logger: homeassistant.setup
Source: components/matrix/__init__.py:328
First occurred: 09:59:13 (1 occurrences)
Last logged: 09:59:13

Error during setup of component matrix
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 249, in _async_setup_component
    result = await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 88, in setup
    bot = MatrixBot(
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 169, in __init__
    self._client = self._login()
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 299, in _login
    client = self._login_by_token()
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 328, in _login_by_token
    return MatrixClient(
  File "/usr/local/lib/python3.9/site-packages/matrix_client/client.py", line 152, in __init__
    self._sync()
  File "/usr/local/lib/python3.9/site-packages/matrix_client/client.py", line 562, in _sync
    for room_id, invite_room in response['rooms']['invite'].items():
KeyError: 'invite'


### Additional information

Using homeserver `matrixdotorg/synapse:v1.38.0` from docker.

Seems live the key is missing, could be a version of Matrix that the client is incompatible with? When I use the Element client it works normal and there are no open invites left. The Rooms that I listen above are 1:1 (personal) chat rooms.
@probot-home-assistant
Copy link

matrix documentation
matrix source
(message by IssueLinks)

@johansmitsnl
Copy link
Contributor Author

johansmitsnl commented Jul 20, 2021

I have noticed that since the synapse 1.38 other libs added robustness for missing fields: ananace/ruby-matrix-sdk@6bbe67c and at the source project there is a open issue on it: matrix-org/matrix-python-sdk#320

@GoSpursGoNL
Copy link

GoSpursGoNL commented Jul 21, 2021

Today I migrated from the Matrix HA addon (for the server part) that I used since a couple of days (wasn't working properly with messages lost, plus the addon no longer being maintained/supported) to Synapse 1.38 on a VPS. I'm running into the same error when setting up the integration in HA. The server itself is working fine.

Since I also upgraded HA (Core) from core-2021.7.2 to .3 today, I rolled back to .2 but that doesn't make any difference.

In the Synapse logging I see no error:

2021-07-21 22:04:20,320 - synapse.rest.client.v1.login - 271 - INFO - POST-3153 - Got login request with identifier: None, medium: None, address: None, user: '@homeassistant:redacted>
2021-07-21 22:04:20,665 - synapse.handlers.auth - 928 - INFO - POST-3153 - Logging in user @homeassistant:redacted on device redacted

@johansmitsnl
Copy link
Contributor Author

@GoSpursGoNL it is not ha that isn't working but a client depend. See linked issue above.

@gvansanden
Copy link

@johansmitsnl I also guess it is in the setup part of home assistant only. I was on 21.7.2 and it still worked, I updated synaps to 1.38 and it still worked, but the upgrade to 7.3 restarted home assistant and it broke at that point

@johansmitsnl
Copy link
Contributor Author

@gvansanden omce you go to 1.38 without a ha restart works fine. When you restart ha (any version) it breaks.

@KardinalReusen
Copy link

I have the same problem

@MatijaTerzic
Copy link

Same problem here

@johansmitsnl
Copy link
Contributor Author

A fix is merged to the master branch of the client library. Now we need a update of the library to bump the HA depend.

MR matrix-org/matrix-python-sdk#321

@johansmitsnl
Copy link
Contributor Author

This issue is a duplicate of #52959 so I'll close this one.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants