-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Supabase Python Client does not close connection & hangs #494
Comments
+1 I'm experiencing the same thing here |
Also stumbled into this issue whenever accessing anything The workaround I settled for was seeding a test user such that I don't have to call any of the INSERT INTO auth.users
(id, instance_id, aud, role, email, encrypted_password, created_at, updated_at, email_confirmed_at, confirmation_sent_at, raw_app_meta_data)
VALUES
('d2ab3142-6538-4e6e-a43b-52a0ffb3ea93', '00000000-0000-0000-0000-000000000000', 'authenticated', 'authenticated', 'test@example.org', 'ENCRYPTED', now(), now(), now(), now(), '{"provider":"email","providers":["email"]}')
RETURNING *; My sloppy workaround was adding this to seed for now, but a cleaner setup would be to call this during setup and then removing it during teardown instead. 🙈 |
@vidbina Same exact issue for me,
and then I tear them down with another |
Can one of you provide a reproducible example repo with this issue? It's easier for us to debug the issue if this is provided. |
@silentworks I don't have an example repo, but I found this ticket after a search as I encountered this problem in a very simple standalone script (also mentioned above by @djmango in the issue description). The user import os
from supabase import create_client
# create client
url = os.environ.get("SUPABASE_TEST_URL")
key = os.environ.get("SUPABASE_TEST_KEY")
client = create_client(url, key)
# sign in
random_email: str = "email@example.com"
random_password: str = "big-secret"
user = client.auth.sign_in_with_password(
{"email": random_email, "password": random_password}
)
print(user) After
Hope that helps. |
I am experiencing this same issue
|
this hangs for me every time
without the (running supabase v 1.2 - on python 3.11) |
FWIW's in my case if I do end my code with |
+1 |
signing out hangs for me, i dont think thats the expected behavior! |
I have tested this and calling Kapture.2023-10-24.at.23.32.42.mp4 |
Closing this out as there has been no activity since my last reply. |
Sorry @silentworks i missed the reply but I would say the client needs to use a daemon thread to make sure it does not hang the whole application. https://docs.python.org/3/library/threading.html#threading.Thread.daemon |
can concur this happened to me to when using it with pytest, and I also use signInWithPassword |
For others coming here, the solution is this one: |
Describe the bug
The Supabase Python client does not close its connection when it goes out of scope or is deleted, leading to connections persisting after tests are completed in a Django test suite.
To Reproduce
Here's an example of code that reproduces the behavior:
Steps to reproduce the behavior:
Expected behavior
The Supabase Python client should automatically close its connection when it goes out of scope or is deleted, allowing Django to clean up its test database after tests are run.
Desktop (please complete the following information):
Additional context
This issue has caused problems in running Django test suites, as it prevents Django from deleting its test database due to the persistent connection. I haven't found any valid workarounds besides keyboard interrupt (e.g., forcing garbage collection), it would be better if the Supabase client could handle this automatically. Additionally, I tested this in a minimal script that just initializes the Supabase client, and the behavior is the same.
The text was updated successfully, but these errors were encountered: