This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Adding a middleware causes background tasks cancellation #5606
Labels
You can continue the conversation there. Go to discussion →
First Check
Commit to Help
Example Code
Description
Executing the sample code causes an unexpected (and apparently unrelated) asyncio
CancelledError
on long running background tasks.Sample output running on uvicorn and calling GET on
/hello
endpoint:The cause seems to be the introduction of a middleware; when removing the middleware fragment everything get fine:
Operating System
macOS Ventura
Operating System Details
Darwin ARM64 M1
FastAPI Version
0.86.0
Python Version
Python 3.10.8
Additional Context
No response
The text was updated successfully, but these errors were encountered: