Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Jul 29, 2025

Because JavaScript can dynamically load code from text like this:

const {dynamicFn} = await import(`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.

Copy link
Contributor

github-actions bot commented Jul 29, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.77 kB +0.03% +6 B 🔺
@sentry/browser - with treeshaking flags 22.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 flags 67.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/react 25.5 kB +0.02% +4 B 🔺
@sentry/react (incl. Tracing) 41.38 kB +0.01% +2 B 🔺
@sentry/vue 28.2 kB +0.02% +4 B 🔺
@sentry/vue (incl. Tracing) 41.22 kB +0.01% +3 B 🔺
@sentry/svelte 23.79 kB +0.02% +4 B 🔺
CDN Bundle 25.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 - uncompressed 73.86 kB +0.01% +7 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 116.3 kB +0.01% +7 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 230.61 kB +0.01% +7 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 243.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-core 47.53 kB +0.1% +46 B 🔺
@sentry/node 145.84 kB +0.04% +55 B 🔺
@sentry/node - without tracing 91.63 kB +0.06% +54 B 🔺
@sentry/aws-serverless 103.08 kB +0.05% +47 B 🔺

View base workflow run

cursor[bot]

This comment was marked as outdated.

@timfish timfish force-pushed the timfish/fix/node-stack-trace-data-uri branch from fcdb0ef to 7072a48 Compare July 29, 2025 19:23
@timfish timfish force-pushed the timfish/fix/node-stack-trace-data-uri branch from c6b2471 to 59550e3 Compare July 29, 2025 19:28
@AbhiPrasad
Copy link
Member

Let's get this backported too!

@AbhiPrasad AbhiPrasad merged commit 8c1149b into develop Jul 31, 2025
346 of 349 checks passed
@AbhiPrasad AbhiPrasad deleted the timfish/fix/node-stack-trace-data-uri branch July 31, 2025 10:58
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.

2 participants