From af58e1bf2ad02b843ea151b9a46c32ad1c3e05c2 Mon Sep 17 00:00:00 2001 From: Gronod Date: Tue, 19 May 2026 20:39:37 +0100 Subject: [PATCH] debug(webhooks): Add console.error logging to Sonarr/Radarr notification routes Added detailed error logging to help diagnose 500 errors when calling Sonarr/Radarr notification APIs. Logs include: - Error message - Response status (if available) - Response data (if available) This will help identify if the issue is: - Missing SONARR_URL/RADARR_URL or API keys - Network connectivity issues - Sonarr/Radarr API version incompatibility --- server/routes/radarr.js | 11 +++++++++++ server/routes/sonarr.js | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/server/routes/radarr.js b/server/routes/radarr.js index fcfc6e5..c697f0f 100644 --- a/server/routes/radarr.js +++ b/server/routes/radarr.js @@ -66,6 +66,7 @@ router.get('/notifications', async (req, res) => { }); res.json(response.data); } catch (error) { + console.error('[Radarr] Failed to fetch notifications:', error.message); res.status(500).json({ error: 'Failed to fetch Radarr notifications', details: sanitizeError(error) }); } }); @@ -126,6 +127,11 @@ router.post('/notifications/test', async (req, res) => { }); res.json(response.data); } catch (error) { + console.error('[Radarr] Failed to test notification:', error.message); + if (error.response) { + console.error('[Radarr] Test response status:', error.response.status); + console.error('[Radarr] Test response data:', error.response.data); + } res.status(500).json({ error: 'Failed to test Radarr notification', details: sanitizeError(error) }); } }); @@ -199,6 +205,11 @@ router.post('/notifications/sofarr-webhook', async (req, res) => { res.json(response.data); } } catch (error) { + console.error('[Radarr] Failed to configure webhook:', error.message); + if (error.response) { + console.error('[Radarr] Response status:', error.response.status); + console.error('[Radarr] Response data:', error.response.data); + } res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) }); } }); diff --git a/server/routes/sonarr.js b/server/routes/sonarr.js index 9e4d4a4..8d6b6d4 100644 --- a/server/routes/sonarr.js +++ b/server/routes/sonarr.js @@ -66,6 +66,7 @@ router.get('/notifications', async (req, res) => { }); res.json(response.data); } catch (error) { + console.error('[Sonarr] Failed to fetch notifications:', error.message); res.status(500).json({ error: 'Failed to fetch Sonarr notifications', details: sanitizeError(error) }); } }); @@ -126,6 +127,11 @@ router.post('/notifications/test', async (req, res) => { }); res.json(response.data); } catch (error) { + console.error('[Sonarr] Failed to test notification:', error.message); + if (error.response) { + console.error('[Sonarr] Test response status:', error.response.status); + console.error('[Sonarr] Test response data:', error.response.data); + } res.status(500).json({ error: 'Failed to test Sonarr notification', details: sanitizeError(error) }); } }); @@ -199,6 +205,11 @@ router.post('/notifications/sofarr-webhook', async (req, res) => { res.json(response.data); } } catch (error) { + console.error('[Sonarr] Failed to configure webhook:', error.message); + if (error.response) { + console.error('[Sonarr] Response status:', error.response.status); + console.error('[Sonarr] Response data:', error.response.data); + } res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) }); } });