From 6f59b5652a12a42990e17abd5d4532040ed8fb01 Mon Sep 17 00:00:00 2001 From: deepshekhardas Date: Fri, 22 May 2026 11:57:08 +0530 Subject: [PATCH] fix: subscribeToBatch Zod stream crash on partial shape updates (#3510) Change zodShapeStream to skip unparseable chunks instead of crashing the entire stream. When ElectricSQL sends partial shape updates during initial sync (missing fields like taskIdentifier, friendlyId, createdAt), the Zod safeParse fails and controller.error() terminates the stream for all subscribers. Now logs a warning and skips the chunk instead. --- packages/core/src/v3/apiClient/stream.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/v3/apiClient/stream.ts b/packages/core/src/v3/apiClient/stream.ts index fc7bcf3db13..6b35e647b4b 100644 --- a/packages/core/src/v3/apiClient/stream.ts +++ b/packages/core/src/v3/apiClient/stream.ts @@ -62,8 +62,10 @@ export function zodShapeStream( if (result.success) { controller.enqueue(result.data); - } else { - controller.error(new Error(`Unable to parse shape: ${result.error.message}`)); + } else if (typeof console !== "undefined") { + console.warn( + `[zodShapeStream] Skipping unparseable shape chunk: ${result.error.message}` + ); } }, })