fix: events silently dropped when message is an object (sentry-dart/Flutter SDK)#279
Merged
Merged
Conversation
Root cause: the Event struct declared message as Option<String>, but
modern Sentry SDKs (Dart/Flutter, JS, etc.) send the Message interface
as an object {"formatted":"...","message":"..."} rather than a
plain string. serde failed with "invalid type: map, expected a
string" and, because the envelope parser used `if let Ok(...)` and
silently discarded the Err, the ENTIRE event was dropped.
Reproduced against a real sentry-dart envelope: "Parsed 0 events"
even though requests reached the server. This matched production logs
showing repeated "Parsed 0 events, 0 transactions" with no error.
Fix:
- proto: custom deserialize_message() accepts both a plain string and
the Message object, collapsing to the formatted display string
(prefers "formatted", falls back to "message").
- ingest: replace silent `if let Ok` drops with explicit match arms
that tracing::warn! the deserialize error (item type + message), so
future field mismatches surface in logs instead of vanishing.
Unknown item types now log at debug instead of being swallowed.
Tests:
- parse_event_message_as_object_sentry_dart_format
- parse_event_message_object_falls_back_to_message_key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The
Eventstruct declaredmessageasOption<String>, but modern Sentry SDKs (Dart/Flutter, JS, Python, etc.) send the Message interface as an object, not a plain string:serde failed with
invalid type: map, expected a stringand — because the envelope parser usedif let Ok(...)and silently discarded theErr— the entire event was dropped with zero log output.Reproduced against production logs
Real sentry-flutter envelopes hit the server but always parsed to zero:
A diagnostic test confirmed the exact serde error:
column 171 = the
messagefield.Fix
1.
trapfall-proto—deserialize_message()Custom deserializer on
Event.messagethat accepts both forms and collapses to the display string:formatted(preferred), falling back tomessageNone2.
trapfall-ingest— stop swallowing errorsReplaced every
if let Ok(...)silent drop with explicitmatcharms thattracing::warn!the item type + error. Unknown item types nowtracing::debug!instead of vanishing. Future field mismatches will surface in logs.Tests
parse_event_message_as_object_sentry_dart_format— the regressionparse_event_message_object_falls_back_to_message_key—formattedabsentVerification
cargo fmt --all -- --check→ cleancargo clippy --workspace --all-targets→ cleancargo test --workspace→ all pass (incl. 2 new)Impact
Events from sentry-dart/Flutter (and any SDK using the Message object form) now land in TrapFall. This was the actual cause of the user's "data tidak masuk" report — not Cloudflare (confirmed: no CF events, requests reached the server).