mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
Aligning MAX_SINGLE_EVENT_BYTES exactly to the server's 8 MiB decompressed cap left no room for the JSON envelope: a single event in the ~250-byte window just under 8 MiB passed the client check but made the server's gunzip exceed maxOutputLength (400). Reserve a 1 KiB envelope margin so a single event that clears the cap can't render a batch over the server's cap. Also log a distinct warning on a 413: the client-side size caps are meant to prevent it, so a 413 signals a poorly-compressible event (embedded image/canvas) that gzipped past the wire limit. The warning now names the 413 and the number of buffered events dropped (the flush stops on any non-2xx, abandoning the rest of the captured buffer).