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

Support asynchronous origin function #507

Open
aprilis opened this issue May 23, 2024 · 1 comment
Open

Support asynchronous origin function #507

aprilis opened this issue May 23, 2024 · 1 comment

Comments

@aprilis
Copy link

aprilis commented May 23, 2024

We want to use origin function in InputAppInfo as described in https://supertokens.com/docs/emailpassword/common-customizations/multiple-clients.

Our logic is to download current origin list from our database using Django ORM. However, currently this is not possible because of the exception: django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async

Wrapping the ORM part with sync_to_async will make the whole function asynchronous but then it must be handled correctly by supertokens (using await keyword). The only solution is to update this repo to handle asynchronous origin function.

@rishabhpoddar
Copy link
Contributor

hey @aprilis this is a good suggestion. In the meantime though, you can load up the list of origins from the database / refresh them in the background periodically and then read from the in memory list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants