Skip to content

fix: add google sheets to refreshWebhooks jobs#410

Merged
joaquimds merged 4 commits intomainfrom
fix/refresh-googlesheets-webhooks
Apr 7, 2026
Merged

fix: add google sheets to refreshWebhooks jobs#410
joaquimds merged 4 commits intomainfrom
fix/refresh-googlesheets-webhooks

Conversation

@joaquimds
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the existing refreshWebhooks job to also cover Google Sheets data sources, and enhances Google Sheets webhook health checks to detect missing webhook rows in addition to formula errors.

Changes:

  • Added Google Sheets handling to the refreshWebhooks scheduled job.
  • Updated GoogleSheetsAdaptor.hasWebhookErrors() to check for both formula error values and row-count mismatches between the main sheet and webhook sheet.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/server/jobs/refreshWebhooks.ts Adds a Google Sheets pass to the webhook refresh job to detect/repair webhook issues.
src/server/adaptors/googlesheets.ts Expands webhook error detection to include missing rows vs the main sheet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/server/jobs/refreshWebhooks.ts Outdated
Comment on lines +357 to +359
const mainSheetData = mainSheetResponse.ok
? ((await mainSheetResponse.json()) as { values: string[][] })
: { values: [] };
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainSheetResponse.ok failures are silently treated as an empty sheet ({ values: [] }), which can mask permission/auth issues and make the “missing rows” check unreliable. Align this with prepareWebhookSheet by handling non-OK responses explicitly (e.g., read the body and throw/log + return) so refreshWebhooks can surface and act on real errors.

Suggested change
const mainSheetData = mainSheetResponse.ok
? ((await mainSheetResponse.json()) as { values: string[][] })
: { values: [] };
if (!mainSheetResponse.ok) {
const responseBody = await mainSheetResponse.text();
logger.warn(
`Could not read main sheet for webhook error check for ${this.dataSourceId}`,
{
status: mainSheetResponse.status,
responseBody,
},
);
throw new Error(
`Failed to read main sheet: ${mainSheetResponse.status}`,
);
}
const mainSheetData =
(await mainSheetResponse.json()) as { values: string[][] };

Copilot uses AI. Check for mistakes.
Comment thread src/server/adaptors/googlesheets.ts Outdated
Comment thread src/server/adaptors/googlesheets.ts
Comment thread src/server/adaptors/googlesheets.ts
joaquimds and others added 3 commits April 7, 2026 12:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@joaquimds joaquimds merged commit c974a58 into main Apr 7, 2026
1 check passed
@joaquimds joaquimds deleted the fix/refresh-googlesheets-webhooks branch April 7, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants