这是indexloc提供的服务,不要输入任何密码
Skip to content

Any path in the LiveKit URL is discarded when the worker tries to connect to the WebSocket #2700

@arpesenti

Description

@arpesenti

I have noticed that any path in the LiveKit URL is discarded when the worker tries to connect to the WebSocket.

For example if LIVEKIT_URL=wss://example.com/SomePath

2025-06-24 15:53:58,980 - WARNING livekit.agents - failed to connect to livekit, retrying in 0s
Traceback (most recent call last):
  File "/home/armando/ArgosAgent/venv/lib/python3.10/site-packages/livekit/agents/worker.py", line 654, in _connection_task
    ws = await self._http_session.ws_connect(
  File "/home/armando/ArgosAgent/venv/lib/python3.10/site-packages/aiohttp/client.py", line 1078, in _ws_connect
    raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 404, message='Invalid response status', url='wss:///example.com/agent'

Notice how /SomePath got lost.

I believe the issue is in livekit/agents/worker.py

path_parts = [f"{scheme}://{parse.netloc}", parse.path, "/agent"]
agent_url = reduce(urljoin, path_parts)

A possible fix I think it's to replace '/agent' with 'agent'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions