Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(trigger): treat Drive rate limits as success to preserve failure …
…budget
  • Loading branch information
waleedlatif1 committed Apr 11, 2026
commit 1ba63399b12ca5439c772c5cd9bde5d9d373a76c
19 changes: 13 additions & 6 deletions apps/sim/lib/webhooks/polling/google-drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ export const googleDrivePollingHandler: PollingProviderHandler = {
)
return 'success'
Comment thread
waleedlatif1 marked this conversation as resolved.
}
if (error instanceof Error && error.name === 'DriveRateLimitError') {
await markWebhookSuccess(webhookId, logger)
logger.warn(
`[${requestId}] Drive API rate limited for webhook ${webhookId}, skipping to retry next poll cycle`
)
return 'success'
}
logger.error(`[${requestId}] Error processing Google Drive webhook ${webhookId}:`, error)
await markWebhookFailed(webhookId, logger)
return 'failure'
Expand Down Expand Up @@ -207,9 +214,9 @@ async function getStartPageToken(
const status = response.status
const errorData = await response.json().catch(() => ({}))
if (status === 403 || status === 429) {
throw new Error(
`Drive API rate limit (${status}) — skipping to retry next poll cycle: ${JSON.stringify(errorData)}`
)
const err = new Error(`Drive API rate limit (${status}): ${JSON.stringify(errorData)}`)
err.name = 'DriveRateLimitError'
throw err
Comment thread
waleedlatif1 marked this conversation as resolved.
}
throw new Error(
`Failed to get Drive start page token: ${status} - ${JSON.stringify(errorData)}`
Expand Down Expand Up @@ -261,9 +268,9 @@ async function fetchChanges(
throw err
}
if (status === 403 || status === 429) {
throw new Error(
`Drive API rate limit (${status}) — skipping to retry next poll cycle: ${JSON.stringify(errorData)}`
)
const err = new Error(`Drive API rate limit (${status}): ${JSON.stringify(errorData)}`)
err.name = 'DriveRateLimitError'
throw err
}
throw new Error(`Failed to fetch Drive changes: ${status} - ${JSON.stringify(errorData)}`)
}
Expand Down
Loading