GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
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
Contributor
Why: How to review: One small helper in 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…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
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
andreiborza
marked this pull request as ready for review
andreiborza
requested review from
Lms24,
chargome,
isaacs,
msonnb and
mydea
and removed request for
a team
andreiborza
approved these changes
chargome
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
chargome
pushed a commit
that referenced
this pull request
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
…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
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]>
51 tasks done
3 tasks done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
external
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. normalize() throws when a getter throws a Symbol or a null-prototype objectUh oh!
There was an error while loading. Please reload this page. 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. |