Skip to content
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

fix(utils/object): fix normalizing error from null #2305

Merged
merged 2 commits into from Nov 11, 2019
Merged

fix(utils/object): fix normalizing error from null #2305

merged 2 commits into from Nov 11, 2019

Conversation

gordomium
Copy link
Contributor

Fix sentry captured extra serialization

require('@sentry/utils/dist/object').normalize({ domain: null })

got **non-serializable**,because of Cannot read property '_events' of null

Copy link
Contributor

@kamilogorek kamilogorek left a comment

Choose a reason for hiding this comment

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

Those functions are written correctly, the bug is inside the first check of normalizeValue.

if (key === 'domain' && typeof value === 'object' && ((value as unknown) as { _events: any })._events) {

This typeof value === 'object' is a false positive for null (classic JS), and it requires a change to:

if (key === 'domain' && value && ((value as unknown) as { _events: any })._events) {

Thanks!

@kamilogorek kamilogorek merged commit 2d5188a into getsentry:master Nov 11, 2019
@gordomium gordomium deleted the fix/object-with-domain-as-non-serializable branch November 11, 2019 11:26
HazAT added a commit that referenced this pull request Nov 15, 2019
* master:
  release: 5.9.0
  feat: Introduce mode option for global promise handler in node (#2312)
  release: 5.8.0
  misc: 5.8.0 changelog update
  fix(utils/object): fix normalizing error from null (#2305)
  doc: Link to discord, not IRC (#2304)
  fix: Skip empty filename in frames and fallback to location
  chore: Linter auto-fixes
  misc: 5.8.0 changelog
  chore: replace several instances of any (#2264)
  feat: 429 http code handling in node/browser transports
  ref: Remove dom references from utils for old TS and env interop
  fix: Gracefuly handle incorrect input from onerror
  feat: Make sure that Debug integration is always setup as the last one

# Conflicts:
#	lerna.json
#	packages/browser/package.json
#	packages/browser/src/version.ts
#	packages/core/package.json
#	packages/hub/package.json
#	packages/integrations/package.json
#	packages/minimal/package.json
#	packages/node/package.json
#	packages/node/src/version.ts
#	packages/utils/package.json
#	packages/utils/src/misc.ts
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.

None yet

2 participants