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

[BUG] Functions executed in separate thread not working due to RuntimeError: Working outside of application context #5843

Closed
Aadesh-Baral opened this issue May 29, 2023 · 0 comments · Fixed by #5852

Comments

@Aadesh-Baral
Copy link
Contributor

Describe the bug
When executing a function on a separate thread that requires access to the Flask application context, the implementation was changed to use current_app instead of creating a new Flask app using create_app() with #5642. However, this change resulted in a RuntimeError with the message Working outside of application context.

This error is raised due to the use of current_app outside of a Flask application context. Flask's current_app is a proxy to the current active application instance, but it requires an active application context to function correctly.
While using current_app outside of an application context, Flask cannot determine the active application instance, leading to the error.

@Aadesh-Baral Aadesh-Baral self-assigned this May 29, 2023
@Aadesh-Baral Aadesh-Baral changed the title [BUG] Email sending functions not working due to RuntimeError: Working outside of application context [BUG] Functions executed in separate thread not working due to RuntimeError: Working outside of application context May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant