How to stop this exceptions to be sent to sentry?

I have this function in my Laravel 5.5 project

   public function report(Exception $exception)
    {
        if (app()->bound('sentry') && $this->shouldReport($exception)){
            app('sentry')->captureException($exception);
        }
    
        parent::report($exception);
    }

The problem is an old component of this big project that is fireing 1000 times a day this exception

User Deprecated: The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.

Note that in my php.ini the E_USER_DEPRECATED errors are not set as reported (i used ~E_USER_DEPRECATED to disable reporting these kind of exceptions.

any way an old Symfony component is doing this:

        @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED);

I cannot simply silent this exception, because silented count for free plan limit ( … because we’re still on free plan, but we loose our 5k/month limit in < 6 days. )

Could you kindly help me to stop sending this specific exception at all to sentry?

We recently introduced a new option called capture_silenced_error see: https://github.com/getsentry/sentry-php/releases/tag/2.0.1

Just make sure to update to the latest version, this should already fix it.

Thanks. How can I use this package?

My dependencies are not directly calling it, I supposed it’s called via sentry/sentry-laravel package.

I also tried

composer require sentry/sdk:2.0.1

                                                                                                               
  [InvalidArgumentException]                                                                                   
  Could not find a matching version of package sentry/sdk:2.0.1. Check the package spelling, your version con  
  straint and that the package is available in a stability which matches your minimum-stability (stable). 

But, as you can see, without success

Hey, sorry if I wasn’t clear enough.
A simple composer update sentry/sentry should do the trick.

sentry/sdk is our meta package that ships with sentry/sentry ^2.0

1 Like

YES !!!

This fixed the spikes, thanks !!!

1 Like