Skip to content

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

Merged
kamilogorek merged 2 commits intogetsentry:masterfrom
gordomium:fix/object-with-domain-as-non-serializable
Nov 11, 2019
Merged

fix(utils/object): fix normalizing error from null#2305
kamilogorek merged 2 commits intogetsentry:masterfrom
gordomium:fix/object-with-domain-as-non-serializable

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.

2 participants