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
Issue: Dependency Context Not Propagating to Broker in Task Execution
Problem Description
I'm using a fastapi_app fixture along with InMemoryBroker and InmemoryResultBackend from taskiq. The setup works well for the FastAPI app itself, but tasks executed by TaskIQ encounter an error related to missing dependencies.
The issue was resolved by explicitly updating the broker’s dependency overrides using fastapi_app.dependency_overrides. The updated code looks like this:
It would be beneficial if the dependency context setup in populate_dependency_context could propagate fastapi_app overrides automatically to broker.dependency_overrides or if documentation could be expanded to clarify this requirement.
The text was updated successfully, but these errors were encountered:
Issue: Dependency Context Not Propagating to Broker in Task Execution
Problem Description
I'm using a
fastapi_app
fixture along withInMemoryBroker
andInmemoryResultBackend
fromtaskiq
. The setup works well for the FastAPI app itself, but tasks executed by TaskIQ encounter an error related to missing dependencies.Here’s a snippet of my
fastapi_app
fixture:And here’s the initialization of the broker:
In
conftest.py
, I also have the following fixture:Issue Observed
Despite setting up the dependency context, task executions still fail with an error indicating missing dependencies. Here’s the error log:
Solution
The issue was resolved by explicitly updating the broker’s dependency overrides using
fastapi_app.dependency_overrides
. The updated code looks like this:Suggested Improvement
It would be beneficial if the dependency context setup in
populate_dependency_context
could propagatefastapi_app
overrides automatically tobroker.dependency_overrides
or if documentation could be expanded to clarify this requirement.The text was updated successfully, but these errors were encountered: