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.
Unable to delete a user with python admin sdk supabase.auth.admin.delete_user
To Reproduce
from supabase import create_client, Client
from now_u_api.settings import SUPABASE
supabase = create_client(SUPABASE.URL, SUPABASE.KEY)
response = supabase.auth.admin.delete_user(self.auth_id)
the values of SUPABASE.URL and SUPABASE.KEY look correct and the auth_id is a valid UUID of one of the users in supabase
Im getting the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gotrue/_sync/gotrue_base_api.py", line 111, in _request
response = self._http_client.request(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 814, in request
request = self.build_request(
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 345, in build_request
url = self._merge_url(url)
File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 375, in _merge_url
merge_url = URL(url)
File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 115, in __init__
self._uri_reference = urlparse(url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/httpx/_urlparse.py", line 162, in urlparse
raise InvalidURL("Invalid non-printable ASCII character in URL")
httpx.InvalidURL: Invalid non-printable ASCII character in URL
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/django/views.py", line 84, in sentry_wrapped_callback
return callback(request, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/rest_framework/generics.py", line 217, in delete
return self.destroy(request, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/rest_framework/mixins.py", line 91, in destroy
self.perform_destroy(instance)
File "/usr/local/lib/python3.10/site-packages/rest_framework/mixins.py", line 95, in perform_destroy
instance.delete()
File "/app/users/models.py", line 110, in delete
response = supabase.auth.admin.delete_user(self.auth_id)
File "/usr/local/lib/python3.10/site-packages/gotrue/_sync/gotrue_admin_api.py", line 164, in delete_user
return self._request("DELETE", f"admin/users/{id}", body=body)
File "/usr/local/lib/python3.10/site-packages/gotrue/_sync/gotrue_base_api.py", line 123, in _request
raise handle_exception(e)
gotrue.errors.AuthRetryableError: Invalid non-printable ASCII character in URL
Bug report
Describe the bug
Unable to delete a user with python admin sdk
supabase.auth.admin.delete_user
To Reproduce
the values of SUPABASE.URL and SUPABASE.KEY look correct and the auth_id is a valid UUID of one of the users in supabase
Im getting the following error:
Expected behavior
User should be deleted
Screenshots
N/A
System information
python 3.10 supabase 2.7.3
Additional context
Add any other context about the problem here.