You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason it doesn't work in repeat_task is because Depends can't be used in our own functions. It has to be in FastAPI function. Refer to this: fastapi/fastapi#1693 (comment)
However, I also trying to access Session from a repeated_task function and is unable. Did anyone found any workaround?
While using
fastapi-utils
scheduler, passingDepends(get_db)
as a parameter to the function doesn't work.This is how it works within FastAPI endpoint:
This is how it doesn't work with FastAPI utils:
(note that the functions are the same, only decorators have changed)
There is no error, but the query is not being called (I think the session is not created?). It just gets stuck.
The
get_db()
function differs a little bit between those two, but under the hood it does the same for both.Environment:
The text was updated successfully, but these errors were encountered: