GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): stop normalize() from throwing on symbol and null-prototype errors by rjmcgee53192 · Pull Request #25967 · getsentry/sentry-javascript

Conversation

@rjmcgee53192

@rjmcgee53192 rjmcgee53192 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Why: normalize() is documented to always return a value, using the **non-serializable** marker when something goes wrong — but it could throw itself. Both places that build that marker interpolated the caught value into a template literal, and that conversion throws for a symbol (Cannot convert a Symbol value to a string) and for an object with no usable toString. A property getter throwing either one is enough to make normalize() throw during event preparation. The caught value is now converted with String() inside a try/catch, falling back to fixed text, so callers only ever get the marker.

How to review: One small helper in packages/core/src/utils/normalize.ts, used by the two catch blocks there. The new tests in normalize.test.ts cover a getter throwing a symbol, a getter throwing a null-prototype object, and the stringifyValue catch failing with a symbol. I verified the fix by running the issue's reproduction against the source directly (both cases threw before, both return the marker after, ordinary inputs unchanged). I could not complete a full local pnpm install in my environment, so CI will be the first full suite run — flagging that honestly rather than claiming a green local run.

Unsure about: Opening this as a draft without a prior maintainer go-ahead on the issue — happy to adjust the approach if you'd rather handle it differently.

Closes #25920

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rjmcgee53192
fix(core): stop normalize() from throwing on symbol and null-prototyp…
6c65c85
…e errors

normalize() built its **non-serializable** marker by interpolating the
caught value into a template literal. That conversion throws for a
symbol and for an object with no usable toString, so a property getter
throwing either one made normalize() throw instead of returning the
marker its docs promise.

Convert the caught value with String() inside a try/catch and fall
back to fixed text when even that throws. Covers both catch blocks in
normalize.ts (normalize and stringifyValue) and adds regression tests
for a getter throwing a symbol, a getter throwing a null-prototype
object, and stringifyValue failing with a symbol.

Fixes getsentry#25920
@github-actions github-actions Bot added the external PR from an external contributor label Oct 30, 2026
@andreiborza

andreiborza commented Nov 6, 2026

Copy link
Copy Markdown
Member

Hi @rjmcgee53192 thanks for the contribution, but next time please follow https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md#external-contributors.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andreiborza
Merge branch 'develop' into contrib/fix-25920
093497f
@andreiborza
andreiborza marked this pull request as ready for review November 6, 2026 10:38
@andreiborza
andreiborza requested review from a team as code owners November 6, 2026 10:38
@andreiborza
andreiborza requested review from Lms24, chargome, isaacs, msonnb and mydea and removed request for a team November 6, 2026 10:38
andreiborza
andreiborza approved these changes Nov 6, 2026
View reviewed changes
chargome
chargome approved these changes Nov 6, 2026
View reviewed changes
@andreiborza
andreiborza merged commit 593e565 into getsentry:develop Nov 6, 2026
356 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@javascript-sdk-gitflow javascript-sdk-gitflow Bot mentioned this pull request Nov 6, 2026
chore: Add external contributor to CHANGELOG.md #26171
Merged
chargome pushed a commit that referenced this pull request Nov 6, 2026
@javascript-sdk-gitflow @andreiborza
chore: Add external contributor to CHANGELOG.md (#26171)
b07cc39
This PR adds the external contributor to the CHANGELOG.md file, so that
they are credited for their contribution. See #25967

Co-authored-by: andreiborza <[email protected]>
43081j pushed a commit to 43081j/sentry-javascript that referenced this pull request Nov 9, 2026
@rjmcgee53192 @andreiborza @43081j
fix(core): stop normalize() from throwing on symbol and null-prototyp…
4cdb08c
…e errors (getsentry#25967)

**Why:** `normalize()` is documented to always return a value, using the
`**non-serializable**` marker when something goes wrong — but it could
throw itself. Both places that build that marker interpolated the caught
value into a template literal, and that conversion throws for a symbol
(`Cannot convert a Symbol value to a string`) and for an object with no
usable `toString`. A property getter throwing either one is enough to
make `normalize()` throw during event preparation. The caught value is
now converted with `String()` inside a try/catch, falling back to fixed
text, so callers only ever get the marker.

**How to review:** One small helper in
`packages/core/src/utils/normalize.ts`, used by the two catch blocks
there. The new tests in `normalize.test.ts` cover a getter throwing a
symbol, a getter throwing a null-prototype object, and the
`stringifyValue` catch failing with a symbol. I verified the fix by
running the issue's reproduction against the source directly (both cases
threw before, both return the marker after, ordinary inputs unchanged).
I could not complete a full local `pnpm install` in my environment, so
CI will be the first full suite run — flagging that honestly rather than
claiming a green local run.

**Unsure about:** Opening this as a draft without a prior maintainer
go-ahead on the issue — happy to adjust the approach if you'd rather
handle it differently.

Closes getsentry#25920

Co-authored-by: Andrei <[email protected]>
43081j pushed a commit to 43081j/sentry-javascript that referenced this pull request Nov 9, 2026
@javascript-sdk-gitflow @andreiborza @43081j
chore: Add external contributor to CHANGELOG.md (getsentry#26171)
992a995
This PR adds the external contributor to the CHANGELOG.md file, so that
they are credited for their contribution. See getsentry#25967

Co-authored-by: andreiborza <[email protected]>
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Nov 10, 2026
publish: getsentry/[email protected] getsentry/publish#10343
Closed
51 tasks done
@github-actions github-actions Bot mentioned this pull request Nov 10, 2026
normalize() throws when a getter throws a Symbol or a null-prototype object #25920
Closed
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chargome chargome chargome approved these changes
@andreiborza andreiborza andreiborza approved these changes
@Lms24 Lms24 Awaiting requested review from Lms24 Lms24 was automatically assigned from getsentry/team-javascript-sdks-browser
@msonnb msonnb Awaiting requested review from msonnb msonnb was automatically assigned from getsentry/team-javascript-sdks-browser
@isaacs isaacs Awaiting requested review from isaacs isaacs was automatically assigned from getsentry/team-javascript-sdks-server
@mydea mydea Awaiting requested review from mydea mydea was automatically assigned from getsentry/team-javascript-sdks-server

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

external PR from an external contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

normalize() throws when a getter throws a Symbol or a null-prototype object

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@rjmcgee53192 @andreiborza @chargome
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.