From 43ce2cc5cd386206ea637a239e814aa42428fdb2 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 9 Apr 2026 14:18:44 -0700 Subject: [PATCH] fix(polling): fix Drive pre-check never activating in Sheets poller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit isDriveFileUnchanged short-circuited when lastModifiedTime was undefined, never calling the Drive API — so currentModifiedTime was never populated, creating a permanent chicken-and-egg loop. Now always calls the Drive API and returns the modifiedTime regardless of whether there's a previous value to compare against. Co-Authored-By: Claude Opus 4.6 --- apps/sim/lib/webhooks/polling/google-sheets.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/sim/lib/webhooks/polling/google-sheets.ts b/apps/sim/lib/webhooks/polling/google-sheets.ts index be9d192b1e..0afe61d9a5 100644 --- a/apps/sim/lib/webhooks/polling/google-sheets.ts +++ b/apps/sim/lib/webhooks/polling/google-sheets.ts @@ -226,13 +226,13 @@ async function isDriveFileUnchanged( requestId: string, logger: ReturnType ): Promise<{ unchanged: boolean; currentModifiedTime?: string }> { - if (!lastModifiedTime) return { unchanged: false } - try { const currentModifiedTime = await getDriveFileModifiedTime(accessToken, spreadsheetId, logger) + if (!lastModifiedTime || !currentModifiedTime) { + return { unchanged: false, currentModifiedTime } + } return { unchanged: currentModifiedTime === lastModifiedTime, currentModifiedTime } } catch (error) { - // If Drive check fails, proceed with Sheets API (don't skip) logger.warn(`[${requestId}] Drive modifiedTime check failed, proceeding with Sheets API`) return { unchanged: false } }