supabase / supabase-py

Python Client for Supabase. Query Postgres from Flask, Django, FastAPI. Python user authentication, security policies, edge functions, file storage, and realtime data streaming. Good first issue.
https://supabase.com/docs/reference/python
MIT License
1.65k stars 191 forks source link

Cannot get past this empty error #790

Closed heymarkreeves closed 3 months ago

heymarkreeves commented 4 months ago

Bug report

Describe the bug

Trying to execute a simple select query using Python 3.12 or 3.9. I cannot get past this error.

To Reproduce

Python 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from supabase import create_client, Client
>>> from supabase.lib.client_options import ClientOptions
>>> url: str = "https://svyjpvnhftybdowglgmt.supabase.co/rest/v1/iot"
>>> key: str = "OMITTED"
>>> client_options = ClientOptions(postgrest_client_timeout=999999, schema="public")
>>> supabase: Client = create_client(url, key, client_options)
>>> print(supabase.table("iot").select("id").execute())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/markreeves/.local/share/virtualenvs/vercel-tidbyt-35n3k3fp/lib/python3.12/site-packages/postgrest/_sync/request_builder.py", line 78, in execute
    raise APIError(r.json())
postgrest.exceptions.APIError: {}
>>> print(supabase)
<supabase._sync.client.SyncClient object at 0x1043c5a30>
>>> print (supabase.table("iot").select("id"))
<postgrest._sync.request_builder.SyncSelectRequestBuilder object at 0x1063f7fe0>

I've tried using postgrest directly too, receive the same error. Same happens with select("*").

Expected behavior

It works in RapidAPI or using requests to simply fetch my project URL, so it's not a permissions issue. I expect to not get an error using the documented methods.

System information

silentworks commented 3 months ago

Your URL is incorrect, it should only be the base url and not the path to the endpoint. You have https://svyjpvnhftybdowglgmt.supabase.co/rest/v1/iot as your url when it should be https://svyjpvnhftybdowglgmt.supabase.co/.