Skip to content

fix(node): Handle stack traces with data URI filenames - #17218

Merged
AbhiPrasad merged 1 commit into
developfrom
timfish/fix/node-stack-trace-data-uri
Jul 31, 2025
Merged

fix(node): Handle stack traces with data URI filenames#17218
AbhiPrasad merged 1 commit into
developfrom
timfish/fix/node-stack-trace-data-uri

Conversation

@timfish

@timfishtimfish commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator

Because JavaScript can dynamically load code from text like this:

const{dynamicFn}=awaitimport(`data:application/javascript,export function dynamicFn() { throw new Error('Error from data-uri module');};`);dynamicFn();

You can get slack lines like this:

 at dynamicFn (data:application/javascript,export function dynamicFn() { throw new Error('Error from data-uri module');};:1:38)

These can be huge, often base64 encoded strings.

Currently we skip regex parsing on anything over 1k in length but that means we ignore the frame entirely.

This PR:

  • Changes the stack parser so that if the line is over 1k, we still pass the first 1k for parsing
  • Adds initial check to the Node line parser that special cases truncated lines with data URIs in them

cursor[bot]

This comment was marked as outdated.

@github-actions

github-actionsBot commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser23.77 kB+0.03%+6 B 🔺
@sentry/browser - with treeshaking flags22.35 kB+0.01%+2 B 🔺
@sentry/browser (incl. Tracing)39.41 kB+0.01%+3 B 🔺
@sentry/browser (incl. Tracing, Replay)77.53 kB+0.01%+5 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags67.4 kB+0.01%+2 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)82.24 kB+0.01%+4 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)94.37 kB+0.01%+5 B 🔺
@sentry/browser (incl. Feedback)40.45 kB+0.02%+5 B 🔺
@sentry/browser (incl. sendFeedback)28.45 kB+0.02%+4 B 🔺
@sentry/browser (incl. FeedbackAsync)33.34 kB+0.02%+6 B 🔺
@sentry/react25.5 kB+0.02%+4 B 🔺
@sentry/react (incl. Tracing)41.38 kB+0.01%+2 B 🔺
@sentry/vue28.2 kB+0.02%+4 B 🔺
@sentry/vue (incl. Tracing)41.22 kB+0.01%+3 B 🔺
@sentry/svelte23.79 kB+0.02%+4 B 🔺
CDN Bundle25.28 kB+0.03%+6 B 🔺
CDN Bundle (incl. Tracing)39.29 kB+0.02%+5 B 🔺
CDN Bundle (incl. Tracing, Replay)75.41 kB+0.01%+6 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)80.84 kB+0.01%+5 B 🔺
CDN Bundle - uncompressed73.86 kB+0.01%+7 B 🔺
CDN Bundle (incl. Tracing) - uncompressed116.3 kB+0.01%+7 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed230.61 kB+0.01%+7 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed243.42 kB+0.01%+7 B 🔺
@sentry/nextjs (client)43.44 kB+0.01%+4 B 🔺
@sentry/sveltekit (client)39.84 kB+0.01%+1 B 🔺
@sentry/node-core47.53 kB+0.1%+46 B 🔺
@sentry/node145.84 kB+0.04%+55 B 🔺
@sentry/node - without tracing91.63 kB+0.06%+54 B 🔺
@sentry/aws-serverless103.08 kB+0.05%+47 B 🔺

View base workflow run

cursor[bot]

This comment was marked as outdated.

@timfish
timfishforce-pushed the timfish/fix/node-stack-trace-data-uri branch from fcdb0ef to 7072a48CompareJuly 29, 2025 19:23
@timfish
timfishforce-pushed the timfish/fix/node-stack-trace-data-uri branch from c6b2471 to 59550e3CompareJuly 29, 2025 19:28
@AbhiPrasad

Copy link
Copy Markdown
Contributor

Let's get this backported too!

@AbhiPrasad
AbhiPrasad merged commit 8c1149b into developJul 31, 2025
346 of 349 checks passed
@AbhiPrasad
AbhiPrasad deleted the timfish/fix/node-stack-trace-data-uri branch July 31, 2025 10:58
AbhiPrasad pushed a commit that referenced this pull request Aug 5, 2025
This PR copies what we did for Node (#17218) but for the Chromium stack
parser.
RulaKhaled pushed a commit that referenced this pull request Aug 7, 2025
This PR copies what we did for Node (#17218) but for the Chromium stack
parser.
Lms24 added a commit that referenced this pull request Aug 7, 2025
…egration` (#17216)
[#17218](#17218)
adjusted data URI stack line parsing for most errors that go through the
stack parsers (fully for node, line truncation in general). This patch now
applies a similar logic to `globalHandlersIntegration` which in some
conditions applies a stack frame that doesn't go through the same stack
parser.
Sign up for freeto 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.

2 participants

@timfish@AbhiPrasad