Matrix connector AttributeError 'RoomContextError' object has no attribute 'event'
See original GitHub issueDescription
Randomly the matrix connector will crash when connected to a public room.
Steps to Reproduce
Create a skill and point it to #geeklab:linuxdelta.com
and wait for people to start talking.
Expected Functionality
For the connector to handle when this attribute doesn’t exist.
Experienced Functionality
Traceback (most recent call last):
File "/home/sleuth/.local/bin/opsdroid", line 33, in <module>
sys.exit(load_entry_point('opsdroid==0.22.0', 'console_scripts', 'opsdroid')())
File "/usr/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.9/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/opsdroid/cli/start.py", line 43, in start
opsdroid.run()
File "/usr/lib/python3.9/site-packages/opsdroid/core.py", line 172, 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/lib/python3.9/site-packages/opsdroid/core.py", line 195, in start
await self._run_tasks()
File "/usr/lib/python3.9/site-packages/opsdroid/core.py", line 206, in _run_tasks
await asyncio.gather(*self.tasks)
File "/usr/lib/python3.9/site-packages/opsdroid/connector/matrix/connector.py", line 345, in listen
async for event in self._parse_sync_response(response):
File "/usr/lib/python3.9/site-packages/opsdroid/connector/matrix/connector.py", line 323, in _parse_sync_response
yield await self._event_creator.create_event(
File "/usr/lib/python3.9/site-packages/opsdroid/events.py", line 34, in create_event
return await self.event_types[event[self.dispatch_key]](event, target)
File "/usr/lib/python3.9/site-packages/opsdroid/connector/matrix/create_events.py", line 89, in create_room_message
return await self.message_events[msgtype](event, roomid)
File "/usr/lib/python3.9/site-packages/opsdroid/connector/matrix/create_events.py", line 107, in create_message
kwargs["linked_event"] = await self.create_event_from_eventid(
File "/usr/lib/python3.9/site-packages/opsdroid/connector/matrix/create_events.py", line 34, in create_event_from_eventid
event_json = room_context.event.source
AttributeError: 'RoomContextError' object has no attribute 'event'
Versions
- Opsdroid version:0.22.0
- Python version: 3.9.5
- OS/Docker version: Manjaro and Docker 20.10.7
Configuration File
My full skill and a default config can be found at https://gitlab.com/Sleuth56/Matrix-Aggregator
welcome-message: false
## Connector modules
connectors:
# ## Matrix (core)
matrix:
# Required
mxid: "@questions:server.com"
password: "*************"
# A dictionary of multiple rooms
# One of these should be named 'main'
rooms:
'main': '#BotTesting:server.com'
# Optional
homeserver: "https://server.com"
nick: "Questions" # The nick will be set on startup
room_specific_nicks: False # Look up room specific nicknames of senders (expensive in large rooms)
enable_encryption: True
device_name: "opsdroid"
device_id: "*******" # A unique string to use as an ID for a persistent opsdroid device
# store_path: "/root/.config/opsdroid/Matrix_cache/" # Path to the directory where the matrix store will be saved
store_path: "Matrix_cache"
databases:
sqlite:
# path: "/root/.config/opsdroid/messages.db"
path: "messages.db"
skills:
matrix-aggregator:
module: 'aggregatorSkill'
# path: /root/.config/opsdroid/Skill/
# path: Skill
logging: True
destination_rooms: ["!room:server.com", "!room:server.com"]
delete_message: "I deleted your entire message."
sent_ack: "I sent your message!"
nothing_to_send: "I don't have anything to send"
nothing_to_preview: "Their isn't anything to preview"
header: "<h2>{user_name} said </h2>"
Additional Details
Any other details you wish to include such as screenshots, console messages, etc.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
opsdroid - bytemeta
connector.matrix.connector: Error during initial sync: unknown error ... Matrix connector AttributeError 'RoomContextError' object has no attribute 'event'.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think we should need a try/except. matrix-nio doesn’t raise exceptions in normal operations if any http or matrix errors happen they are returned as a error response not raised as an exception.
Yes I understand the implementation so the room_context has to be compare using isinstance and if it does not match log the error and return the eventid. I can do this however wouldnt it be better to execute this using a try catch in case error comes while getting the room_context value then we can catch the error log it and return eventid.
i can do both the ways however just wanted to clarify which way to go.