Open sara-jegorova opened 2 years ago
Thanks for the report @sara-jegorova. Do you know whether you're passing any property values to track()
that aren't simply serializable, for instance a native Error object as in https://github.com/mixpanel/mixpanel-js/issues/317? This infinite recursion issue happens when you pass an Object to track()
that has a circular reference to itself somewhere, and you mention it only happens on one browser, hence the suspicion that you're tracking something as a prop that the browser has natively produced.
Hi @tdumitrescu , thanks for having a look. The only complex info I'm passing to track()
is from reportWebVitals()
in CRA which uses the web-vitals
library, as it passes Metric
: https://github.com/GoogleChrome/web-vitals/blob/main/src/types.ts#L39 . I think that if I just stop passing entries
, these errors should go away.
Yes, generally you want to choose explicitly how to serialize values like that. This will also ensure that your tracking properties remain consistent across browsers.
There seems to be a problem with the truncate function in https://github.com/mixpanel/mixpanel-js/blob/master/dist/mixpanel.cjs.js#L421, where it gets stuck on an infinite loop. I found the issue via our runtime error logs, and it seems to happen only to samsung internet 16.0 browser. I was not able to reproduce the issue myself, but it might be worth looking into. Here's a screenshot of the callstack:
I'm using npm package
mixpanel-browser
version2.41.0
.