Skip to content

sign_in_with_password locking python unittest #844

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

Closed
FelipeNFL opened this issue Jun 28, 2024 · 5 comments
Closed

sign_in_with_password locking python unittest #844

FelipeNFL opened this issue Jun 28, 2024 · 5 comments
Labels
wontfix This will not be worked on

Comments

@FelipeNFL
Copy link

Bug report

Describe the bug

I'm using the Supabase Client Python with the unittest library to make some asserts in a data transform. But, if when I use the sign_in_with_password() method in the setUpClass to log in the project, the terminal is locked after the tests execution. The process is not kill and the Ctrl+C doesn't work too. I tried to call close() in the auth, but the problem persists. It appears there to be some deadlock.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Import the supabase in a unittest file
  2. Create a client
  3. Call sign_in_with_passwod() in the setUpClass
  4. Wait for the test execution end
  5. See the error

Expected behavior

The process needs to be killed when the test finishes.

System information

  • OS: Windows 11
  • Version of supabase-python: 2.5.1
  • Version of Python: 3.12.3
@FelipeNFL FelipeNFL added the bug Something isn't working label Jun 28, 2024
@silentworks
Copy link
Contributor

You just need to sign_out in order for it to not be locked. This has been discussed in a past issue.

The discussion here with one solution of calling sign_out: #494 (comment)
Another solution here of passing a config property: #451 (comment)

@silentworks silentworks added wontfix This will not be worked on and removed bug Something isn't working labels Jun 29, 2024
@chriscarrollsmith
Copy link

Here's my use case: I'm trying to pass the user's JWT token from a Javascript frontend to a Python backend so that I can log the user in on the backend and perform RLS-protected operations. I'm using supabase.auth.set_session to get the job done. This causes Pytest to hang, and supabase.auth.sign_out() doesn't fix the issue in this case.

I mean, it might just be that this is a bad approach. I suspect that signout on the backend will sign the user out from the frontend too, although I've not even gotten that far in my testing due to this Pytest issue. So at the moment, I'm leaning toward dropping the whole idea of passing the session from frontend to backend like this.

But if there's a way to clean up the threads associated with supabase.auth.set_session, and to do it without signing out the user on the frontend, I'd love to know about it.

@silentworks
Copy link
Contributor

silentworks commented Jul 6, 2024

@chriscarrollsmith Did you try the other solution of passing the config property on initiating the client in Python?

Also @chriscarrollsmith are you the same person as @FelipeNFL?

@chriscarrollsmith
Copy link

chriscarrollsmith commented Jul 6, 2024

@chriscarrollsmith Did you try the other solution of passing the config property on initiating the client in Python?

Also @chriscarrollsmith are you the same person as @FelipeNFL?

Thanks; I somehow missed that in your reply above and will give it a try. (No, I am not the same person as Felipe.)

@silentworks
Copy link
Contributor

Closing out as no reply from OP for more than two months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants