Skip to content

ref(node): Stop custom-handling normalization of Domain/DomainEmitter - #21182

Merged
mydea merged 1 commit into
developfrom
fn/normalize-domain
May 27, 2026
Merged

ref(node): Stop custom-handling normalization of Domain/DomainEmitter#21182
mydea merged 1 commit into
developfrom
fn/normalize-domain

Conversation

@mydea

Copy link
Copy Markdown
Member

We have custom code normalizing Domain and DomainEmitter, which are node-only but deprecated and not widely used anymore. This would have affected this being serialized in a nested object, e.g. extra, where it would be something like:

// The rule is shape-based, not identity-based: any EventEmitter under `domain` matches.constemitter=newEventEmitter();emitter.on('error',()=>undefined);expect(normalize({domain: emitter})).toEqual({domain: '[Domain]'});

or

// The Node `domain` module stamps the originating EventEmitter onto caught errors// under `domainEmitter`. The rule is unconditional on the key match — no shape check —// so even non-emitter values under `domainEmitter` get replaced.constrealEmitter=newEventEmitter();realEmitter.on('data',()=>undefined);expect(normalize({domainEmitter: realEmitter})).toEqual({domainEmitter: '[DomainEmitter]'});

(We don't really have tests for this, I added these to verify how this looks today, they are not in the PR since they would be removed again basically)

With this PR, they will be normalized "normally", meaning they'd look something like this:

{
- "domain": "[Domain]",+ "domain": {+ "_events": {+ "newListener": "[Function: updateExceptionCapture]",+ "removeListener": "[Function: updateExceptionCapture]",+ },+ "_eventsCount": 2,+ "_maxListeners": undefined,+ "members": [],+ },
}

or

{
- "domainEmitter": "[DomainEmitter]",+ "domainEmitter": {+ "_events": {+ "data": "[Function: <anonymous>]",+ },+ "_eventsCount": 1,+ "_maxListeners": undefined,+ },
}

which is of course "worse" but IMHO this deprecated, not widely used feature does not necessarily warranty special handling in core - this code is also shipped to browsers.

@mydeamydea self-assigned this May 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.27 kB-0.17%-46 B 🔽
@sentry/browser - with treeshaking flags25.69 kB-0.2%-50 B 🔽
@sentry/browser (incl. Tracing)45.27 kB-0.1%-45 B 🔽
@sentry/browser (incl. Tracing + Span Streaming)47.51 kB-0.1%-44 B 🔽
@sentry/browser (incl. Tracing, Profiling)50.25 kB-0.1%-47 B 🔽
@sentry/browser (incl. Tracing, Replay)84.87 kB-0.06%-46 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags74.38 kB-0.07%-47 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas)89.59 kB-0.06%-47 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback)102.2 kB-0.05%-45 B 🔽
@sentry/browser (incl. Feedback)44.46 kB-0.11%-45 B 🔽
@sentry/browser (incl. sendFeedback)32.09 kB-0.16%-49 B 🔽
@sentry/browser (incl. FeedbackAsync)37.21 kB-0.12%-43 B 🔽
@sentry/browser (incl. Metrics)28.37 kB-0.15%-40 B 🔽
@sentry/browser (incl. Logs)28.59 kB-0.16%-44 B 🔽
@sentry/browser (incl. Metrics & Logs)29.29 kB-0.16%-45 B 🔽
@sentry/react29.01 kB-0.15%-42 B 🔽
@sentry/react (incl. Tracing)47.5 kB-0.1%-46 B 🔽
@sentry/vue32.19 kB-0.15%-47 B 🔽
@sentry/vue (incl. Tracing)47.13 kB-0.1%-44 B 🔽
@sentry/svelte27.3 kB-0.18%-47 B 🔽
CDN Bundle29.68 kB-0.16%-46 B 🔽
CDN Bundle (incl. Tracing)47.8 kB-0.09%-39 B 🔽
CDN Bundle (incl. Logs, Metrics)31.17 kB-0.15%-45 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics)49.05 kB-0.09%-44 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics)70.48 kB-0.08%-50 B 🔽
CDN Bundle (incl. Tracing, Replay)85.3 kB-0.05%-37 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)86.45 kB-0.06%-44 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback)91.17 kB-0.04%-34 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.33 kB-0.05%-39 B 🔽
CDN Bundle - uncompressed87.69 kB-0.13%-112 B 🔽
CDN Bundle (incl. Tracing) - uncompressed144.18 kB-0.08%-110 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed92.18 kB-0.13%-112 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed147.94 kB-0.08%-110 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed216.91 kB-0.06%-112 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed262.96 kB-0.05%-110 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed266.7 kB-0.05%-110 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed276.66 kB-0.04%-110 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed280.39 kB-0.04%-110 B 🔽
@sentry/nextjs (client)49.99 kB-0.09%-42 B 🔽
@sentry/sveltekit (client)45.75 kB-0.11%-50 B 🔽
@sentry/core/server76.44 kB-0.06%-39 B 🔽
@sentry/core/browser63.19 kB-0.07%-42 B 🔽
@sentry/node-core62.54 kB-0.08%-47 B 🔽
@sentry/node131.06 kB-0.04%-44 B 🔽
@sentry/node - without tracing74.98 kB-0.06%-45 B 🔽
@sentry/aws-serverless87.2 kB-0.06%-44 B 🔽
@sentry/cloudflare (withSentry) - minified173.4 kB-0.07%-114 B 🔽
@sentry/cloudflare (withSentry)433.33 kB-0.05%-187 B 🔽

View base workflow run

@mydea
mydea marked this pull request as ready for review May 27, 2026 07:24
@mydea
mydea requested review from a team, JPeer264, Lms24, isaacs and timfish and removed request for a teamMay 27, 2026 07:24

@timfishtimfish left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agreed, no point special casing any more!

@JPeer264JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm okay with the change. Also nice to see from time to time that all bundle sizes go down in a PR

@mydea
mydea merged commit e44882a into developMay 27, 2026
265 of 266 checks passed
@mydea
mydea deleted the fn/normalize-domain branch May 27, 2026 09:03
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.

3 participants

@mydea@timfish@JPeer264