Sentry-php: Request Entity Too Large

Created on 6 Feb 2019  路  5Comments  路  Source: getsentry/sentry-php

on execute
private function cleanupPendingRequests()

} catch (\Throwable $exception) {
dump($exception);
// Do nothing because an exception thrown from a destructor
// can't be catched in PHP (see http://php.net/manual/en/language.oop5.decon.php#language.oop5.decon.destructor)
}

recive uncatched error
'Request Entity Too Large'

how to fix this and don't lose errors?

Question

All 5 comments

i think problem in very big stack trace.

I don't know specifically what's the data that is too big, but generally speaking the payload that is being sent to the server is too big and it rejects it. It's not something that we can fix in the SDK itself since it depends on the amount of information that you are gathering. You could try to debug your application and trim the data that is too big using the before_send option, an event processor or something like that

i use laravel
app('sentry')->captureException($exception);

can you give some example how I can trim data?
i see in my case $exception has very big trace

ok
i found solution for me
in config/sentry.php

'before_send' => function ($event) { 
        $exs=$event->getExceptions();
        if(is_array($exs))
        foreach($exs as $k=>$ex)
        {
            $c=count($ex['stacktrace']->toArray());
            if($c>50)
            for($i=0;$i<($c-50);$i++)
            {
                $ex['stacktrace']->removeFrame(0);
            }
            $exs[$k]=$ex;
        }
        $event->setExceptions($exs);
        return $event; 
    }

Closing this since you solved your problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanMikes picture JanMikes  路  4Comments

brunowowk picture brunowowk  路  5Comments

mesilov picture mesilov  路  5Comments

realtebo picture realtebo  路  5Comments

Kleingeld picture Kleingeld  路  5Comments