Skip to content

fix(desktop): handle missing autoUpdater on unsigned macOS builds#391

Merged
skevetter merged 1 commit into
mainfrom
fix/unsigned-updater-crash
May 20, 2026
Merged

fix(desktop): handle missing autoUpdater on unsigned macOS builds#391
skevetter merged 1 commit into
mainfrom
fix/unsigned-updater-crash

Conversation

@skevetter

@skevetter skevetter commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Guards all electron-updater autoUpdater access with availability checks
  • On unsigned builds (no Apple code signing), the user now sees "Auto-update is not available (app is not code-signed)" instead of a crash
  • Prevents the "Cannot read properties of undefined (reading 'checkForUpdates')" error on macOS

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced robustness of the auto-update feature with improved availability checks and error handling.
    • Added validation guards to prevent failures when update components are unavailable.
    • Improved error messaging for update-related issues.

Review Change Stack

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.
@netlify

netlify Bot commented May 20, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 8d2fe85
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a0cfb0286a4f30008177c89

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Four functions in the update module now include defensive checks to verify that electron-updater methods exist before calling them. initAutoUpdater, checkForUpdates, and checkForUpdatesWithChannel guard autoUpdater.checkForUpdates with early returns and logging or error signaling when unavailable. installUpdate guards autoUpdater.quitAndInstall before invocation.

Changes

Update Flow Robustness

Layer / File(s) Summary
Availability guards for autoUpdater methods
desktop/src/main/updater.ts
initAutoUpdater checks for checkForUpdates and logs a warning if missing. checkForUpdates performs the same check and emits an error status if unavailable. checkForUpdatesWithChannel includes the guard, configures channel and prerelease flags, then calls checkForUpdates. installUpdate guards quitAndInstall before calling it.

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/s

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding guards to handle missing autoUpdater functionality on unsigned macOS builds, which is the core purpose of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
desktop/src/main/updater.ts (1)

175-177: 💤 Low value

Consider adding logging for observability.

While the guard correctly prevents the crash, installUpdate silently returns when quitAndInstall is 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

📥 Commits

Reviewing files that changed from the base of the PR and between bda9a80 and 8d2fe85.

📒 Files selected for processing (1)
  • desktop/src/main/updater.ts

@skevetter skevetter merged commit c13bc4f into main May 20, 2026
21 checks passed
@skevetter skevetter deleted the fix/unsigned-updater-crash branch May 20, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant