Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rrweb logger error: TypeError: Do not know how to serialize a BigInt #968

Closed
bitjson opened this issue Jan 24, 2024 · 6 comments
Closed

Comments

@bitjson
Copy link

bitjson commented Jan 24, 2024

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.

@pauldambra
Copy link
Member

Screenshot 2024-01-24 at 23 26 34

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 GoogleChromeLabs/jsbi#30 (comment)

@pauldambra
Copy link
Member

Ah, and it's already a known issue there rrweb-io/rrweb#1209

@pauldambra
Copy link
Member

fix proposed here rrweb-io/rrweb#1403

@bitjson
Copy link
Author

bitjson commented Jan 25, 2024

Fantastic, thanks @pauldambra! Looks like it was already merged into master there – any idea when that might land in posthog-js?

@pauldambra
Copy link
Member

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

@pauldambra
Copy link
Member

That fix is now merged in rrweb, so this should be fine in latest versions

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

No branches or pull requests

2 participants