Skip to content

missing await in async create_client on 2.5.2 and up #860

Closed
@realChesta

Description

@realChesta

Bug report

Describe the bug

The async create_client function uses an async function (AsyncClient.create) without awaiting it, leading to the return of a double-nested coroutine that needs two await calls to get to the client. The signature mismatches the actually returned type.

Users who try using the function according to the signature will receive an unresolved coroutine object instead of an AsyncClient, preventing its use.

To Reproduce

import asyncio
from supabase._async.client import create_client

async def main():
    url = ...
    key = ... 
    client = await create_client(url, key, ClientOptions(storage_client_timeout=300))
    await client.table('flowers').select('*').execute()

asyncio.run(main())

will result in an exception being thrown as the client object is a coroutine:

Exception: 'coroutine' object has no attribute 'table'

Expected behavior

The create_client function should return a coroutine that resolves to an AsyncClient.

Metadata

Metadata

Assignees

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