Skip to content

[Bug]: Async HTTP client heartbeat calls the API root instead of /heartbeat #6870

@YizukiAme

Description

@YizukiAme

What happened?

AsyncFastAPI.heartbeat() requests the empty path "" instead of /heartbeat. That means await chromadb.AsyncHttpClient(...).heartbeat() hits the base API URL and then expects a JSON object with "nanosecond heartbeat".

On a normal deployment this returns unrelated content or a 404/redirect payload, so the public async health-check method fails even though the server is up. The sync HTTP client correctly uses /heartbeat.

Root Cause

# chromadb/api/async_fastapi.py
async def heartbeat(self) -> int:
    response = await self._make_request("get", "")  # ← empty path!
    return int(response["nanosecond heartbeat"])

# chromadb/api/fastapi.py (sync — correct)
def heartbeat(self) -> int:
    resp_json = self._make_request("get", "/heartbeat")  # ← correct path

Expected Behavior

AsyncFastAPI.heartbeat() should call /heartbeat, matching the sync implementation and server contract.

Suggested Fix

async def heartbeat(self) -> int:
    response = await self._make_request("get", "/heartbeat")
    return int(response["nanosecond heartbeat"])

Versions

  • Chroma: latest main
  • Python: 3.12
  • OS: Linux

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions