diff --git a/apps/sim/lib/webhooks/polling/google-drive.ts b/apps/sim/lib/webhooks/polling/google-drive.ts index 7cfadea76c..2ea50a4274 100644 --- a/apps/sim/lib/webhooks/polling/google-drive.ts +++ b/apps/sim/lib/webhooks/polling/google-drive.ts @@ -87,7 +87,6 @@ export const googleDrivePollingHandler: PollingProviderHandler = { ) const config = webhookData.providerConfig as unknown as GoogleDriveWebhookConfig - const now = new Date() // First poll: get startPageToken and seed state if (!config.pageToken) { diff --git a/apps/sim/lib/webhooks/polling/google-sheets.ts b/apps/sim/lib/webhooks/polling/google-sheets.ts index 6216e65378..636a4d0654 100644 --- a/apps/sim/lib/webhooks/polling/google-sheets.ts +++ b/apps/sim/lib/webhooks/polling/google-sheets.ts @@ -95,7 +95,7 @@ export const googleSheetsPollingHandler: PollingProviderHandler = { webhookId, { lastKnownRowCount: currentRowCount, - lastModifiedTime: currentModifiedTime, + lastModifiedTime: currentModifiedTime ?? config.lastModifiedTime, lastCheckedTimestamp: now.toISOString(), }, logger @@ -118,7 +118,7 @@ export const googleSheetsPollingHandler: PollingProviderHandler = { webhookId, { lastKnownRowCount: currentRowCount, - lastModifiedTime: currentModifiedTime, + lastModifiedTime: currentModifiedTime ?? config.lastModifiedTime, lastCheckedTimestamp: now.toISOString(), }, logger @@ -195,7 +195,9 @@ export const googleSheetsPollingHandler: PollingProviderHandler = { webhookId, { lastKnownRowCount: newLastKnownRowCount, - lastModifiedTime: hasRemainingOrFailed ? config.lastModifiedTime : currentModifiedTime, + lastModifiedTime: hasRemainingOrFailed + ? config.lastModifiedTime + : (currentModifiedTime ?? config.lastModifiedTime), lastCheckedTimestamp: now.toISOString(), }, logger