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

[maybe Matrix related] constraints.py, line 34, in constraint_callback 'NoneType' object has no attribute 'connector' #1975

Open
szimszon opened this issue Dec 21, 2022 · 2 comments

Comments

@szimszon
Copy link
Contributor

Description

ERROR: Unhandled exception in opsdroid, exiting...
Caught exception
{'message': 'Task exception was never retrieved', 'exception': AttributeError("'NoneType' object has no attribute 'close'"), 'future': <Task finished name='Task-3' coro=<OpsDroid.handle_stop_signal() done, defined at /usr/local/lib/python3.9/dist-packages/opsdroid/core.py:162> exception=AttributeError("'NoneType' object has no attribute 'close'")>}
Traceback (most recent call last):
  File "/usr/local/bin/opsdroid", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/cli/start.py", line 43, in start
    opsdroid.run()
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/core.py", line 176, in run
    self.eventloop.run_until_complete(self.start())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/core.py", line 199, in start
    await self._run_tasks()
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/core.py", line 210, in _run_tasks
    await asyncio.gather(*self.tasks)
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/connector/matrix/connector.py", line 345, in listen
    await self.opsdroid.parse(event)
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/core.py", line 650, in parse
    await asyncio.gather(*tasks)
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/parsers/event_type.py", line 55, in parse_event_type
    if not constraint(event):
  File "/usr/local/lib/python3.9/dist-packages/opsdroid/constraints.py", line 34, in constraint_callback
    if hasattr(message.connector, "lookup_target"):
AttributeError: 'NoneType' object has no attribute 'connector'

Steps to Reproduce

Please also include relevant information and steps to reproduce the bug/issue.
I use @constrain_rooms(['...']) in my skill (https://gitlab.com/raywiss/skill-feed/-/tree/main) and after I added some feeds to rooms in the background I started getting exceptions like above.

Expected Functionality

I shouldn't get exceptions...

Versions

  • Opsdroid version: 0.28
  • Python version: 3.9
  • OS/Docker version: Debian

Additional Details

I changed the constraints.py line 34 from

           if hasattr(message.connector, "lookup_target"):

to

           if hasattr(message, "connector") and hasattr(message.connector, "lookup_target"):

I don't know why the message is a NoneType :(

@szimszon
Copy link
Contributor Author

Another exception File "/usr/local/lib/python3.9/dist-packages/opsdroid/constraints.py", line 37, in constraint_callback:

AttributeError: 'NoneType' object has no attribute 'target'

@szimszon
Copy link
Contributor Author

🤔

It happens when I kick someone from the room. It generates an event in Matrix which is some kind on "state" event and not a message...

@szimszon szimszon changed the title constraints.py, line 34, in constraint_callback 'NoneType' object has no attribute 'connector' [maybe Matrix related] constraints.py, line 34, in constraint_callback 'NoneType' object has no attribute 'connector' Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant