You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Logs: entire log queue is dropped if a single log is bad #5186
⬇ Place the `npx react-native@latest info` output here. ⬇
Sentry.init()
Sentry.init({dsn: 'https://...@sentry.io/...'// other options});
Steps to Reproduce
I don't know why the broken log actually gets dropped, but it also drops the other healthy logs. We moved it to the logs project because it seems to be related to backend.
for (let i = 0; i < 30; i++){
Sentry.logger.info(`LOOP 5 healthy log 0 - ${i + 1}`);
}
Sentry.logger.error('lets break this (LVL 5)', {
bad5: '{"a":"\uD800"}',
});
Investigated whether this affects other Sentry SDKs. Here's a summary:
Root cause is in Relay — expand_log_container in relay-server/src/processing/logs/process.rs parses the entire {"items": [...]} log container with serde_json in one shot. Any invalid Unicode in any item (like an unpaired surrogate \uD800) causes the whole batch to be rejected with DiscardReason::InvalidJson. This affects all SDKs.
Cross-SDK vulnerability:
SDK
Per-Item Error Handling
Surrogate-Safe Encoding
Risk
sentry-javascript / sentry-react-native
No
No (JSON.stringify preserves surrogates)
High
sentry-dotnet
No
No (Utf8JsonWriter throws on unpaired surrogates in .NET 8+)
High
sentry-java
No
Partial (Gson writes surrogates through without throwing, but Relay rejects)
Medium
sentry-dart
Yes (try/catch at add-time)
No explicit sanitization
Medium
sentry-python
No per-item fallback
Yes (json.dumps escapes surrogates to ASCII by default)
Activity
linear commentedon Sep 22, 2025
RN-341 Logs: entire log queue is dropped if a single log is bad
lucas-zimerman commentedon Oct 3, 2025
Happens with raw Javascript too.
log was sent, spotlight only removed the problematic one whereas sentry removed all logs
AbhiPrasad commentedon Oct 20, 2025
Assigning myself so I can investigate further.
antonis commentedon Apr 13, 2026
Investigated whether this affects other Sentry SDKs. Here's a summary:
Root cause is in Relay —
expand_log_containerinrelay-server/src/processing/logs/process.rsparses the entire{"items": [...]}log container withserde_jsonin one shot. Any invalid Unicode in any item (like an unpaired surrogate\uD800) causes the whole batch to be rejected withDiscardReason::InvalidJson. This affects all SDKs.Cross-SDK vulnerability:
JSON.stringifypreserves surrogates)Utf8JsonWriterthrows on unpaired surrogates in .NET 8+)json.dumpsescapes surrogates to ASCII by default)Stringcan't represent unpaired surrogates)Two-layer fix would be ideal:
fix(core): Sanitize lone surrogates in log body and attributes
antonis commentedon Apr 13, 2026
Opened getsentry/sentry-javascript#20245 to handle the SDK side (2) of the fix
fix(core): Sanitize lone surrogates in log body and attributes
fix(core): Sanitize lone surrogates in log body and attributes
fix(logs): Recover log containers with lone Unicode surrogates
fix(core): Sanitize lone surrogates in log body and attributes
fix(logs): Recover log containers with lone Unicode surrogates
fix(core): Sanitize lone surrogates in log body and attributes (#20245)