This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
ContextVar modified in async deps are not available in middleware (with structlog) #4696
Closed
9 tasks done
Labels
First Check
Commit to Help
Example Code
Description
The included code lets you reproduce the issue. This is what's logged:
In the last "request finished" line, I was expected
in_dep=true
to be kept, but it's not there.It might be coming from
structlog
, but I doubt it since it's probably just usingcontextvars
under the hood.Operating System
macOS
Operating System Details
No response
FastAPI Version
0.75.0
Python Version
3.9.10
Additional Context
Tickets that seem relevant to this issue:
I have read the following pages:
In the meantime I might be using https://github.com/snok/asgi-correlation-id
The text was updated successfully, but these errors were encountered: