heiseonline / perl-sentry-sdk

Other
8 stars 6 forks source link

Event ID returned even when submit failed #18

Closed slobo closed 1 week ago

slobo commented 1 year ago

I tried sending a very large event (10k breadcrumbs) which resulted in sentry server responding with 413, but the SDK still gave back an event_id, making it impossible to know whether submission was successful or not.

Sentry::SDK->init(..., debug => 1);
Sentry::SDK->add_breadcrumb({ 
  message  => "Test breadcrumb for a very large event $_", 
  category => "log", 
  level => 'info' 
}) for 1..10_000;
my $event_id = Sentry::SDK->capture_exception('dummy');

print "Event ID: $event_id\n";
...
<<<<
Code: 413
[Sentry] Error: Request Entity Too Large

Event ID: 60ba1af39ef54eeea30135945921cace

Ideally, SDK should automatically strip away some breadcrumbs if the request is going to be larger than some (configurable) size, but at the very least it shouldn't return a fake event_id.

pmb0 commented 1 week ago

Breadcrumbs are now limited to 100 by default (as in other SDKs). This setting can be overridden by SENTRY_MAX_BREADCRUMBS.