Skip to content

Handle BigInt safely in Inspectable.stringifyCircular #4662

@aniravi24

Description

@aniravi24

What version of Effect is running?

3.14.2

What steps can reproduce the bug?

Use Effect.log* with the Effect json logger on a Cause.prettyError (which holds a span with a status that contains a bigint).

What is the expected behavior?

It shouldn't cause an error - when this log fails it causes a defect that can fail silently.

What do you see instead?

'Do not know how to serialize a BigInt': TypeError: Do not know how to serialize a BigInt at JSON.stringify () at stringifyCircular (/node_modules/.pnpm/effect@3.14.2/node_modules/effect/src/Inspectable.ts:110:23) at options (/node_modules/.pnpm/effect@3.14.2/node_modules/effect/src/internal/logger.ts:96:43) at opts (/node_modules/.pnpm/effect@3.14.2/node_modules/effect/src/internal/fiberRuntime.ts:1433:55) at f (/node_modules/.pnpm/effect@3.14.2/node_modules/effect/src/internal/fiberRuntime.ts:866:18) at withRedactableContext (/node_modules/.pnpm/effect@3.14.2/node_modules/effect/src/Inspectable.ts:159:12) at log (/node_modules/.pnpm/effect@3.14.2/node_modules/effect/src/internal/fiberRuntime.ts:864:19) at fiberState (/node_modules/.pnpm/effect@3.14.2/node_modules/effect/src/internal/core-effect.ts:895:16)

Additional information

I don't use BigInts anywhere, so I don't think it could come from anything else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions