fix(desktop): handle missing autoUpdater on unsigned macOS builds#391
Conversation
electron-updater's autoUpdater is undefined when the app is not code-signed, causing a crash when clicking "Check for Updates". Guard all autoUpdater access with availability checks and surface a user-friendly error message instead.
✅ Deploy Preview for devsydev canceled.
|
📝 WalkthroughWalkthroughFour functions in the update module now include defensive checks to verify that ChangesUpdate Flow Robustness
🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
desktop/src/main/updater.ts (1)
175-177: 💤 Low valueConsider adding logging for observability.
While the guard correctly prevents the crash,
installUpdatesilently returns whenquitAndInstallis unavailable. For consistency with the other functions and to aid debugging, consider adding a warning log similar to line 70.📋 Suggested enhancement
export async function installUpdate(): Promise<void> { const { autoUpdater } = await import("electron-updater") if (!autoUpdater || typeof autoUpdater.quitAndInstall !== "function") { + console.warn("Cannot install update: quitAndInstall not available") return } autoUpdater.quitAndInstall() }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@desktop/src/main/updater.ts` around lines 175 - 177, The installUpdate function currently returns silently when autoUpdater is falsy or lacks quitAndInstall; add an observability warning before the return to mirror other functions (e.g., use the existing logger.warn or processLogger.warn) so callers can see why install was skipped. Locate the installUpdate function and the autoUpdater check (references: autoUpdater and its quitAndInstall method) and insert a concise warning log stating that quitAndInstall is unavailable and the update will not be installed, then return as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@desktop/src/main/updater.ts`:
- Around line 175-177: The installUpdate function currently returns silently
when autoUpdater is falsy or lacks quitAndInstall; add an observability warning
before the return to mirror other functions (e.g., use the existing logger.warn
or processLogger.warn) so callers can see why install was skipped. Locate the
installUpdate function and the autoUpdater check (references: autoUpdater and
its quitAndInstall method) and insert a concise warning log stating that
quitAndInstall is unavailable and the update will not be installed, then return
as before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7a0aaed1-e8b3-4df9-8f2d-49b7e0c28d50
📒 Files selected for processing (1)
desktop/src/main/updater.ts
Summary
electron-updaterautoUpdater access with availability checksSummary by CodeRabbit