The Grafana Faro Web SDK, part of the Grafana Faro project, is a highly configurable web SDK for real user monitoring (RUM) that instruments browser frontend applications to capture observability signals. Frontend telemetry can then be correlated with backend and infrastructure data for full-stack observability.
A "Maximum call stack size exceeded" during JSON serialisation happens when an object contains circular references.
Circular references happen when an object references itself directly or through one of its child objects.
Example for a circular reference.
const x = {};
const y = { x };
x.y = y
Proposed solution
To handle circular references, you can use a custom replacer function as the second argument to JSON.stringify(). This function can check for circular references and either replace them with something JSON can serialize (like null or a special marker) or omit them from the resulting JSON.
Description
A user reported a
Maximum call stack size exceeded
exception in Faro.A "Maximum call stack size exceeded" during JSON serialisation happens when an object contains circular references. Circular references happen when an object references itself directly or through one of its child objects.
Example for a circular reference.
Proposed solution
To handle circular references, you can use a custom replacer function as the second argument to JSON.stringify(). This function can check for circular references and either replace them with something JSON can serialize (like null or a special marker) or omit them from the resulting JSON.
Context