Skip to content

JSON Serialization error with circular reference #2190

@cgeorg

Description

@cgeorg

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.4.3,5.5.0

Description

When serializing an event/error that contains a circular reference, a browser error occurs, and then that error is logged, losing the original error.

Repro steps: open a console with sentry SDK loaded and initialized, run:

var obj = {};
obj.repro = obj;
Sentry.captureEvent(obj);

Logged stack trace in Sentry from the above:

TypeError
Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    --- property 'repro' closes the circle
<anonymous> in JSON.stringify
../src/transports/fetch.ts in sendEvent at line 15:18
../../core/src/basebackend.ts in sendEvent at line 96:21
../../core/src/baseclient.ts in onfulfilled at line 353:32
../../utils/src/syncpromise.ts in onSuccess at line 127:21
../../utils/src/syncpromise.ts at line 86:52
<anonymous> in Array.forEach
../../utils/src/syncpromise.ts in _executeHandlers at line 86:22
../../utils/src/syncpromise.ts in _attachHandler at line 96:10
../../utils/src/syncpromise.ts in callback at line 106:12
../../utils/src/syncpromise.ts in new n at line 42:7
../../utils/src/syncpromise.ts in then at line 105:12
../../core/src/baseclient.ts in callback at line 342:46
../../utils/src/syncpromise.ts in new n at line 42:7
../../core/src/baseclient.ts in _processEvent at line 341:12
../../core/src/baseclient.ts in method at line 135:10
../../hub/src/hub.ts in _invokeClient at line 81:27
../../hub/src/hub.ts in method at line 223:10
../../minimal/src/index.ts in callOnHub at line 13:17
../../minimal/src/index.ts in Object.n.captureEvent at line 64:10
<anonymous> at line 3:8

Link to affected production issue in Sentry (my guess is that this is an error involving the Datatables JS library, not sure though): https://sentry.io/organizations/grasp-and-grow/issues/1107636848/

I see similar issues, but they seem to involve memory consumption and crashes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions