Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete a user with admin auth #911

Closed
JElgar opened this issue Aug 24, 2024 · 1 comment
Closed

Unable to delete a user with admin auth #911

JElgar opened this issue Aug 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@JElgar
Copy link

JElgar commented Aug 24, 2024

Bug report

  • [Maybe?] I confirm this is a bug with Supabase, not with my own application.
  • [Y] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

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

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.

@JElgar JElgar added the bug Something isn't working label Aug 24, 2024
@JElgar
Copy link
Author

JElgar commented Aug 24, 2024

I had a new line character at the end of the url 🤦

@JElgar JElgar closed this as completed Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant