agents icon indicating copy to clipboard operation
agents copied to clipboard

Using @job.room.on("data_received") callback throws errors when a server sent data event.

Open vanics opened this issue 1 year ago • 2 comments

Hi all,

Using @job.room.on("data_received") callback throws errors when a server sent data event (non-participant).

Traceback (most recent call last):
  File "/Users/icaro/Dev/InterScribe/backend/agents/tts-openai/venv/lib/python3.12/site-packages/livekit/rtc/room.py", line 247, in _listen_task
    self._on_room_event(event.room_event)
  File "/Users/icaro/Dev/InterScribe/backend/agents/tts-openai/venv/lib/python3.12/site-packages/livekit/rtc/room.py", line 402, in _on_room_event
    rparticipant = self._retrieve_remote_participant(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/icaro/Dev/InterScribe/backend/agents/tts-openai/venv/lib/python3.12/site-packages/livekit/rtc/room.py", line 455, in _retrieve_remote_participant
    participant = self.participants[sid]
                  ~~~~~~~~~~~~~~~~~^^^^^
KeyError: ''
 {"job_id": "AJ_EgYQRzdiNgiR", "pid": 93368}
2024-07-01 14:40:30,361 - ERROR root - error running user callback for data_packet_received: room_handle: 3
data_packet_received {
  kind: KIND_RELIABLE
  user {

vanics avatar Jul 01 '24 18:07 vanics

Hey @vanics, this is going to be fixed by https://github.com/livekit/python-sdks/pull/215 We will release a new version with this fix soon

theomonnom avatar Jul 07 '24 18:07 theomonnom

Amazing. You folks are doing great. Thank you, @theomonnom !

vanics avatar Jul 09 '24 13:07 vanics