BUG: Proxy routes use legacy single-instance environment variables instead of multi-instance config #33
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The proxy routes for Sonarr, Radarr, and SABnzbd (
/queue,/history,/series,/notifications/:id,/notifications(POST/PUT/DELETE), etc.) bypass the modern multi-instance configurations and are hardcoded to use legacy single-instance environment variables (process.env.SONARR_URL,process.env.SONARR_API_KEY, etc.).Root Cause
In
server/routes/sonarr.js,server/routes/radarr.js, andserver/routes/sabnzbd.js, endpoints retrieve information by direct request using the legacy environment variables:This is inconsistent with other parts of the system, such as
server/utils/config.jsand some/notificationsendpoints, which correctly use multi-instance configurations (e.g.getSonarrInstances()).Impact
In environments configured exclusively with the modern multi-instance JSON arrays (e.g.
SONARR_INSTANCES), these proxy routes will fail completely with connection errors orTypeErrorbecause legacy environment variables are undefined.Steps to Reproduce
SONARR_INSTANCESvia JSON array in the environment variables, leavingSONARR_URLandSONARR_API_KEYundefined./api/sonarr/queueor/api/sonarr/historyendpoint.TypeErrorsinceprocess.env.SONARR_URLis undefined.Proposed Fix
Update these route controllers to:
getSonarrInstances(),getRadarrInstances(),getSABnzbdInstances()).getFirstSonarrInstance()for all endpoints in the router).instance.urlandinstance.apiKeydynamically.Resolved via commit
2e9fe8e.