sentry-symfony
sentry-symfony copied to clipboard
RequestFetcher doesn't return request
How do you use Sentry?
Self-hosted / on-premises
SDK version
4.8.0
Steps to reproduce
Make any request with body and you won't see body or method in sentry.
The problem is in RequestFetcher which relies on getting request from RequestStack. The problem here is that the RequestIntegration which uses RequestFetcher to get request runs on kernel.terminate. By this time, the RequestStack is empty because the handle method of the HttpKernel pops that request from the stack and terminate is called after handle.
Expected result
Data from request will be logged in sentry
Actual result
No data from request are logged
I started looking into this, we might need to cache the request somewhere early in the live cycle. We do the same in our Laravel SDK, so I think this should work in Symfony as well.
Why caching? Wouldn't be enough to trigger that earlier, i.e. on kernel.request? Or even better, on-demand? We may need to investigate side-effects...
Because we need the data when an error happens (the easy part) and on transaction finish, which happens on kernel.terminate. Hence we store the request early, and have it laying around for the duration of the entire request.
Hey, just wondering how it was working before, cause I have a feeling I have the same issue, which for some reason appears only in prod environment and only on some of the endpoints.
Did it appear on 5.0 release?