From 4031628f4b0bf94f98ed8622f602cb8f21cb216f Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Sat, 11 Apr 2026 01:44:41 -0500 Subject: [PATCH] fix(seerr): add main.mediaServerType to settings.json to prevent crash Seerr's checkOverseerrMerge calls Settings.load with raw=true, which replaces this.data entirely with file contents. If settings.main is absent (as in our jellyfin-only restore), it crashes at line 418: 'Cannot read properties of undefined (reading apiKey)'. restore.js now ensures settings.main exists and mediaServerType=JELLYFIN, which both prevents the crash and causes checkOverseerrMerge to return early (migration already done). --- servers/legion/k8s/media/overseerr.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/servers/legion/k8s/media/overseerr.yaml b/servers/legion/k8s/media/overseerr.yaml index f583b71..29f6a3b 100644 --- a/servers/legion/k8s/media/overseerr.yaml +++ b/servers/legion/k8s/media/overseerr.yaml @@ -29,14 +29,26 @@ data: if (fs.existsSync(SETTINGS)) { try { settings = JSON.parse(fs.readFileSync(SETTINGS, 'utf8')); } catch(e) {} } + // Seerr's Settings.load runs in raw mode during the overseerrMerge check, + // which replaces this.data entirely with the file contents. If settings.main + // is absent, it crashes at "this.data.main.apiKey" (settings/index.js:418). + // Ensure main exists with mediaServerType=JELLYFIN so the merge check is skipped. + if (!settings.main) { + settings.main = {}; + } + if (!settings.main.mediaServerType) { + settings.main.mediaServerType = 'JELLYFIN'; + console.log('Set main.mediaServerType = JELLYFIN'); + } if (!settings.jellyfin || !settings.jellyfin.apiKey) { console.log('Jellyfin apiKey missing — restoring from defaults'); settings.jellyfin = JSON.parse(fs.readFileSync(DEFAULTS, 'utf8')); - fs.writeFileSync(SETTINGS, JSON.stringify(settings, null, 2)); console.log('Restored Jellyfin config'); } else { console.log('Jellyfin config present, skipping restore'); } + fs.writeFileSync(SETTINGS, JSON.stringify(settings, null, 2)); + console.log('Settings written successfully'); --- apiVersion: apps/v1 kind: Deployment