Normally, I'm able to access the raw request payload in my Flask app using request.get_data()
but I get an empty string when the APM agent is used. In Flask, I would need to call request.get_data()
before accessing anything from the request
object otherwise payload parsing would be triggered based on the content-type
header. However, it seems like the python APM agent accesses the request
object before I'm able to do so which triggers the payloads parsing and prevents me from accessing the raw request payload.
Currently, I have the APM agent turned off since retrieving the raw payload is crucial for my own use case to compute payload hashes but I'm wondering if anyone has any suggested solution to keep the APM on and still be able to get the raw payload?
Thanks!
NOTE: APM agent version: elastic-apm[flask]==5.4.3