releases.shpreview

Fetch/XHR wrapper no longer overflows stack on repeated cycles

posthog-js@1.398.2

July 7, 2026PostHog JSView original ↗
3 fixesThis release3 fixesBug fixesAI-tallied from the release notes
From the original release noteView original ↗

1.398.2

Patch Changes

  • #4063 24aadd5 Thanks @posthog! - Fix a RangeError: Maximum call stack size exceeded that could originate from the shared patch() fetch/XHR wrapper. posthog-js wraps window.fetch in two independent places (tracing headers and session-recording network capture), so their restores routinely ran out of order. Previously an out-of-order restore silently no-op'd, leaving the wrapper in the call path; repeated start/stop cycles grew the wrapper chain without bound until a real fetch walked a chain deep enough to overflow the stack. Wrappers now delegate through a mutable link so any layer can be torn down even when newer wrappers sit on top of it, keeping the chain bounded. Header-injection and network-capture behavior is unchanged. (2026-07-07)

  • #4100 e250a24 Thanks @marandaneto! - Stop adding the gzip compression query parameter to browser SDK requests. (2026-07-07)

  • #4083 f07e241 Thanks @posthog! - fix(replay): harden session-replay network capture so instrumentation that throws (e.g. new Request() rejecting a URL/method) degrades gracefully and never breaks or misattributes the host application's own xhr.open() / fetch() calls (2026-07-07)

Fetched July 7, 2026