Skip to content

storage3 vectors list_indexes() drops next_token and max_results #1632

Description

@hsusul

Bug report

VectorBucketScope.list_indexes() sends its pagination arguments under snake_case keys, but the Storage /vector/ListIndexes endpoint only understands camelCase. next_token and max_results are therefore silently ignored by the server.

https://github.com/supabase/supabase-py/blob/main/src/storage/src/storage3/_async/vectors.py#L76-L78

body = self.with_metadata(
    next_token=next_token, max_results=max_results, prefix=prefix
)

Every other vector request in the same file uses the wire names (maxResults, nextToken in list_buckets() and VectorIndexScope.list()), and the response model the SDK hands back is itself camelCase (ListVectorIndexesResponse.nextToken). The server's schema (list-indexes.ts) accepts vectorBucketName, maxResults, nextToken, prefix and does not reject unknown properties, so there is no error — the values just vanish. The sync client has the same code.

Impact

  • max_results is ignored; the server always uses its default page size (500).
  • next_token is ignored, so every "next page" request returns the first page again. The usual pagination loop never terminates for a bucket with more than one page of indexes:
page = await storage.vectors().from_("embeddings").list_indexes()
while page.nextToken:
    page = await storage.vectors().from_("embeddings").list_indexes(
        next_token=page.nextToken  # dropped on the wire -> same page forever
    )

Reproduction

import asyncio, json
from httpx import AsyncClient, MockTransport, Response
from storage3 import AsyncStorageClient

def handler(request):
    print(json.loads(request.content))
    return Response(200, json={"indexes": []})

async def main():
    storage = AsyncStorageClient(
        "https://example.supabase.co/storage/v1/",
        {"apikey": "key"},
        http_client=AsyncClient(transport=MockTransport(handler)),
    )
    await storage.vectors().from_("my-bucket").list_indexes(
        next_token="cursor-1", max_results=10
    )

asyncio.run(main())

Expected behavior

{'vectorBucketName': 'my-bucket', 'nextToken': 'cursor-1', 'maxResults': 10}

Actual behavior

{'vectorBucketName': 'my-bucket', 'next_token': 'cursor-1', 'max_results': 10}

System information

  • supabase-py: main @ bb7ecc5
  • Package: storage3 (async and sync)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonPull requests that update Python codestorageIssues related to storage-py

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions