debug(webhooks): Add console.error logging to Sonarr/Radarr notification routes
All checks were successful
Build and Push Docker Image / build (push) Successful in 27s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m3s
CI / Security audit (push) Successful in 1m19s
CI / Tests & coverage (push) Successful in 1m34s

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
This commit is contained in:
2026-05-19 20:39:37 +01:00
parent 2d04402284
commit af58e1bf2a
2 changed files with 22 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ router.get('/notifications', async (req, res) => {
}); });
res.json(response.data); res.json(response.data);
} catch (error) { } catch (error) {
console.error('[Radarr] Failed to fetch notifications:', error.message);
res.status(500).json({ error: 'Failed to fetch Radarr notifications', details: sanitizeError(error) }); 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); res.json(response.data);
} catch (error) { } 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) }); 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); res.json(response.data);
} }
} catch (error) { } 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) }); res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) });
} }
}); });

View File

@@ -66,6 +66,7 @@ router.get('/notifications', async (req, res) => {
}); });
res.json(response.data); res.json(response.data);
} catch (error) { } catch (error) {
console.error('[Sonarr] Failed to fetch notifications:', error.message);
res.status(500).json({ error: 'Failed to fetch Sonarr notifications', details: sanitizeError(error) }); 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); res.json(response.data);
} catch (error) { } 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) }); 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); res.json(response.data);
} }
} catch (error) { } 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) }); res.status(500).json({ error: 'Failed to configure Sofarr webhook', details: sanitizeError(error) });
} }
}); });