posthog-js
posthog-js copied to clipboard
`rrweb logger error: TypeError: Do not know how to serialize a BigInt`
My application logs a complex object that contains some values of type BigInt
. This works in the user's development console, but posthog-js@npm:1.101.0
returns the error:
rrweb logger error: TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at Lt (/node_modules/rrweb/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js:56:17)
at node_modules/rrweb/es/rrweb/packages/rrweb/src/plugins/console/record/index.js:112:53
at Array.map (<anonymous>)
at console.log (node_modules/rrweb/es/rrweb/packages/rrweb/src/plugins/console/record/index.js:112:42)
Is there some way to exclude this particular console.log
from rrweb logging?
I'd love to be able to use something like window._posthogMasked.console.log
(which could hold the un-instrumented console.log
) for this particular logging statement.
Yep, bigint isn't json stringifiable
This would need to be fixed in rrweb downstream from us...
You can patch this in your environment... for example https://github.com/GoogleChromeLabs/jsbi/issues/30#issuecomment-1006088574
Ah, and it's already a known issue there https://github.com/rrweb-io/rrweb/issues/1209
fix proposed here https://github.com/rrweb-io/rrweb/pull/1403
Fantastic, thanks @pauldambra! Looks like it was already merged into master there – any idea when that might land in posthog-js
?
I know the folk running rrweb are working on some issues before they can release their next version. So no timescale unfortunately. But we're excited for a few other fixes too so as soon as its available we'll move across
That fix is now merged in rrweb, so this should be fine in latest versions