Closed Physikbuddha closed 10 months ago
Thanks for the issue. The Upcoming major release provides a possibility to pass custom options via EXTCONF
. EXTENSIONS
is not good for it, because these setting types are very limited (no array, closures, ...).
It's now possible to pass custom sentry options, see v5.0.0
Currently, this extension only allows configuring a handful of the available Sentry options. They are
dsn
,release
,environment
andin_app_include
. Other options such aserror_types
,http_proxy
,attach_stacktrace
, andbefore_send
are set automatically. However, there are a lot more configuration options available (see https://docs.sentry.io/platforms/php/configuration/options/), and I would like to make use of them, but I don't see any way how I can modify the$options
array myself (https://github.com/networkteam/sentry_client/blob/master/Classes/Client.php).Specific use case: I am not seeing the body of a POST request in the Sentry backend when additional files were uploaded with the request. This is because the default configuration value for
max_request_body_size
ismedium
(10 KB), and although the uploaded files are not passed to Sentry, the SDK is calculating the body size by using the PSR-17 request'sContent-Length
field (see https://github.com/getsentry/sentry-php/blob/1ad6831202b6d739bf820a6bea6735d32af610b2/src/Integration/RequestIntegration.php#L210).There are two possible ways to solve this specific problem: You can either set the
max_request_body_size
value toalways
, or register a custom RequestFetcherInterface that modifies the value of theContent-Length
field to match the "actual" body size before passing the request to the Sentry SDK.Unfortunately, this extension doesn't allow configurating either of these options.
I think the best way to do this would be to allow setting additional options in the extension configuration, and then pass them to the Sentry SDK. My suggestion would be
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sentry_client']['additionalConfiguration'] = [...]
and merging this into the existing $options array. I was thinking about using a PSR-14 event for this, but since the code is called when an exception is thrown and TYPO3 is about to shut down, it might not be a good idea.I could create a pull request for this myself, but wanted to ask for your opinion on this first.