fix: add google sheets to refreshWebhooks jobs#410
Conversation
There was a problem hiding this comment.
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
refreshWebhooksscheduled 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.
| const mainSheetData = mainSheetResponse.ok | ||
| ? ((await mainSheetResponse.json()) as { values: string[][] }) | ||
| : { values: [] }; |
There was a problem hiding this comment.
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.
| 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[][] }; |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.