Skip to content

Conversation

@isaacs
Copy link
Member

@isaacs isaacs commented Dec 4, 2025

This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline base64-encoded media properties are filtered out. This allows the message to possibly be included in the span, indicating to the user that a media object was present, without overflowing the allotted buffer for sending data.

If a media message is not removed, the fallback is still to simply remove it if its overhead grows too large.

Re JS-1002
Re GH-17810

Message truncation (for text length and inline media) still needs to be added to the docs.

@linear
Copy link

linear bot commented Dec 4, 2025

@isaacs isaacs requested a review from RulaKhaled December 4, 2025 22:11
isaacs added a commit that referenced this pull request Dec 4, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 7c5aad2 to 3512099 Compare December 4, 2025 22:12
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.81 kB - -
@sentry/browser - with treeshaking flags 23.3 kB - -
@sentry/browser (incl. Tracing) 41.55 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.14 kB - -
@sentry/browser (incl. Tracing, Replay) 79.97 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.7 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.64 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 96.89 kB - -
@sentry/browser (incl. Feedback) 41.52 kB - -
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.48 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.75 kB - -
@sentry/vue 29.27 kB - -
@sentry/vue (incl. Tracing) 43.36 kB - -
@sentry/svelte 24.82 kB - -
CDN Bundle 27.24 kB - -
CDN Bundle (incl. Tracing) 42.23 kB - -
CDN Bundle (incl. Tracing, Replay) 78.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.21 kB - -
CDN Bundle - uncompressed 80.04 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.39 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.42 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.18 kB - -
@sentry/nextjs (client) 45.97 kB - -
@sentry/sveltekit (client) 41.92 kB - -
@sentry/node-core 51.5 kB - -
@sentry/node 160.19 kB +0.23% +360 B 🔺
@sentry/node - without tracing 92.91 kB - -
@sentry/aws-serverless 108.44 kB +0.01% +1 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,095 - 8,679 +5%
GET With Sentry 1,700 19% 1,681 +1%
GET With Sentry (error only) 6,073 67% 6,043 +0%
POST Baseline 1,197 - 1,203 -0%
POST With Sentry 595 50% 581 +2%
POST With Sentry (error only) 1,064 89% 1,052 +1%
MYSQL Baseline 3,356 - 3,297 +2%
MYSQL With Sentry 453 13% 426 +6%
MYSQL With Sentry (error only) 2,721 81% 2,665 +2%

View base workflow run

isaacs added a commit that referenced this pull request Dec 5, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 3512099 to 5d7bbc8 Compare December 5, 2025 23:13
isaacs added a commit that referenced this pull request Dec 8, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

If any truncation occurs, then a `client.recordDroppedEvent()` message
is fired, with the reason `before_send`, category `attachment`, and the
count of messages affected.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 5d7bbc8 to 3e58d4b Compare December 8, 2025 17:46
isaacs added a commit that referenced this pull request Dec 8, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

If any truncation occurs, then a `client.recordDroppedEvent()` message
is fired, with the reason `before_send`, category `attachment`, and the
count of messages affected.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 3e58d4b to 687dd68 Compare December 8, 2025 21:34
Copy link
Member

@RulaKhaled RulaKhaled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work. I left a comment can you please resolve it before merging? and i recommend adding an integration test for this after fixing lint issues.

return [];
}

const REMOVED_STRING = '<removed>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RulaKhaled how do we usually mark redacted data in the JS SDK? I couldn't find other uses of this anywhere, just want to make sure we're consistent in how we mark this type of thing - especially across SDKs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a quick check with @sentrivana - there is no such string in python usually, but they do add a _meta entry when removing entire values (see here). Sensitive data is marked using [Filtered].

isaacs added a commit that referenced this pull request Dec 9, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

If any truncation occurs, then a `client.recordDroppedEvent()` message
is fired, with the reason `before_send`, category `attachment`, and the
count of messages affected.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 687dd68 to 0b22140 Compare December 9, 2025 19:00
isaacs added a commit that referenced this pull request Dec 10, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

If any truncation occurs, then a `client.recordDroppedEvent()` message
is fired, with the reason `before_send`, category `attachment`, and the
count of messages affected.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 0b22140 to 6692634 Compare December 10, 2025 14:59
isaacs added a commit that referenced this pull request Dec 10, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

If any truncation occurs, then a `client.recordDroppedEvent()` message
is fired, with the reason `before_send`, category `attachment`, and the
count of messages affected.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 6692634 to f3ccd12 Compare December 10, 2025 15:56
isaacs added a commit that referenced this pull request Dec 10, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from f3ccd12 to ba36a66 Compare December 10, 2025 21:31
@isaacs isaacs marked this pull request as ready for review December 10, 2025 21:32
isaacs added a commit that referenced this pull request Dec 10, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from ba36a66 to 816ad3e Compare December 10, 2025 21:33
isaacs added a commit that referenced this pull request Dec 10, 2025
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 816ad3e to 22a1a57 Compare December 10, 2025 23:12
This is the functional portion addressing JS-1002.

Prior to truncating text messages for their byte length, any inline
base64-encoded media properties are filtered out. This allows the
message to possibly be included in the span, indicating to the user that
a media object was present, without overflowing the allotted buffer for
sending data.

If a media message is not removed, the fallback is still to simply
remove it if its overhead grows too large.

Re JS-1002
Re GH-17810
@isaacs isaacs force-pushed the isaacschlueter/js-1002-drop-media-from-messages-in-sdks-and-document-behavior branch from 22a1a57 to 1095669 Compare December 10, 2025 23:13
}
if (isContentMedia(message)) {
newMessage = stripInlineMediaFromSingleMessage(message);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Media message overwrite discards prior content stripping

When a message matches both isContentArrayMessage (or isPartsMessage) AND isContentMedia at the top level, the stripInlineMediaFromSingleMessage call at line 363 uses the original message instead of the already-processed newMessage. This overwrites prior content/parts stripping. Additionally, since MEDIA_FIELDS includes 'content', the original content array would be replaced with '[Filtered]' string, losing all message content structure. This occurs for messages that have inline media fields (like inlineData, b64_json, or type: 'base64') at the top level alongside a content or parts array.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants