sentry-javascript: DataCloneError when capturing events with raven-js

Do you want to request a feature or report a bug?

bug

(If this is a usage question, please do not post it here—post it on forum.sentry.io instead. If this is not a “feature” or a “bug”, or the phrase “How do I…?” applies, then it’s probably a usage question.)

What is the current behavior?

raven-js throws a DataCloneError on Firefox iOS`

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.

What is the expected behavior?

raven-js should not throw errors 😃

Which versions of Raven.js, and which browser and OS are affected by this issue? Did this work in previous versions of Raven.js? Are you using the CDN (http://ravenjs.com)? Are you using hosted Sentry or on-premises? If on-premises, which version (e.g. 8.7.0)?

DataCloneError
The object can not be cloned.
./node_modules/raven-js/src/raven.js in this at line 360:0

Seeing this with: Self-hosted sentry version 3.22.1 Firefox iOS 10.6 iOS 11.2.5

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (8 by maintainers)

Most upvoted comments

I’ve seen the error reported by desktop browsers - Chrome, Edge and Opera on Windows XP through 10. Two of the reports included a referrer: facebook.com. Interestingly, all of the reports list Facebook-owned IP addresses.

The problem is still persistent with v4.0.5, however now it’s possible to see the debug backtrace of the initial error which is nice. https://sentry.io/share/issue/44d31cc02817475882cd519056b36558/

@n-sviridenko its already out, check the main repo page 😃

@mscuthbert This was also my feeling… That while this error is not likely raven’s fault, it should still handle it more gracefully than it does currently.

That said, I have not seen that error at all since I first opened this issue.

We might want to change the issue title though if people truly are seeing it on browsers OTHER than Firefox for iOS 😉

@kamilogorek – are you sure that it’s a user-code exception? It looks to me that a user-code exception is causing Raven to want to report the user problem but then what is being reported is actually an error in _reportEvent, trying to clone the user function (which will always be different) as part of the Raven script. But I think that Raven should have a fallback if it tries to clone a function that can’t be cloned.

Thanks for the response and amazing software!

I’ve just started to get the same message on Raven from a windows 10 machine running Chrome 68. The full stack trace is:

DataCloneError: Failed to execute ‘postMessage’ on ‘Window’: function (a){if(qe.$a.hasOwnProperty(a))return qe.$a[a]} could not be cloned. at _reportEvent (/:1:35800) at eval (/:1:35800) at eval (/:1:35800)

I’m not using WebWorkers at all in my code and don’t recognize the code as my own at all.

I did recently add code that had WeakMaps in it to my stack, and thinking from my experience in other languages I can imagine that WeakRefereces might cause errors in cloning, especially since WeakMaps and WeakSets don’t allow iterating.