Skip to content

storage3 analytics list() ignores sort_column and sort_order #1635

Description

@hsusul

Bug report

StorageAnalyticsClient.list() sends its sort options as snake_case query parameters, but the Storage GET /iceberg/bucket endpoint only reads camelCase. sort_column and sort_order are therefore silently ignored.

https://github.com/supabase/supabase-py/blob/main/src/storage/src/storage3/_async/analytics.py#L35-L41

params = dict(
    limit=limit,
    offset=offset,
    sort_column=sort_column,   # sent as ?sort_column=...
    sort_order=sort_order,     # sent as ?sort_order=...
    search=search,
)

The server's query schema (iceberg/bucket.ts) declares limit, offset, sortColumn, sortOrder, search, and storage-js sends sortColumn / sortOrder. Unknown query keys are not rejected, so there is no error: the buckets just come back in the default order. limit, offset and search work because their names are the same in both conventions. The sync client has the same code.

Reproduction

from httpx import Client, MockTransport, Response
from storage3 import SyncStorageClient

def handler(request):
    print(dict(request.url.params))
    return Response(200, json=[])

storage = SyncStorageClient(
    "https://example.supabase.co/storage/v1/",
    {"apikey": "key"},
    http_client=Client(transport=MockTransport(handler)),
)
storage.analytics().list(sort_column="created_at", sort_order="desc")

Expected behavior

{'sortColumn': 'created_at', 'sortOrder': 'desc'}

Actual behavior

{'sort_column': 'created_at', 'sort_order': 'desc'}

The server ignores both keys, so list(sort_column="created_at", sort_order="desc") returns buckets in the default order. Code that takes the first element as "newest bucket" gets the wrong bucket.

System information

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

    bugSomething isn't workingpythonPull 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