Skip to content

fix(media-stack): fetch the Servarr host config under the configured UrlBase (Refs #858) - #959

Open
K4r3s-git wants to merge 1 commit into
MagnaCapax:mainfrom
K4r3s-git:fix/servarr-seed-urlbase
Open

K4r3s-git wants to merge 1 commit into
MagnaCapax:mainfrom
K4r3s-git:fix/servarr-seed-urlbase

Conversation

@K4r3s-git

Copy link
Copy Markdown

Fixes the Servarr auth-seed failure (Invalid Servarr host-config JSON) tracked in #858. Refs #858.

Cause: servarr_install_from_url writes <UrlBase>/public-<user>/<app></UrlBase> before servarr_auth_seed runs, so the prefix is live on the seed start. base_url in servarr_auth_seed has no prefix:

GET /api/v3/config/host                       -> 307, empty body
GET /public-<user>/sonarr/api/v3/config/host  -> 200, application/json

curl -fsS (no -L) exits 0 on the 307, so the empty body reaches json_decode.

Change:

  • New helper servarr_host_config_url reads UrlBase from config.xml (trailing slash stripped; empty, self-closing or missing UrlBase means no prefix) and builds the host-config URL under it.
  • servarr_auth_seed uses it for base_url, so the probe, the fetch, the PUT and the unauthenticated 401 check all go to the prefixed path.

Tests:

  • New testServarrHostConfigUrlUsesUrlBase: Radarr prefix (v3), Prowlarr prefix with trailing slash (v1), empty UrlBase, <UrlBase />, and a missing config file.
  • testServarrAuthSeedAuthenticatesProbeReadAndWrite now extracts the helper too, and the string assertion in testServarrAuthSeedingUsesLocalApiAndFailsClosed checks the new call.
  • installMediaStackScriptTest.php: 55/55 pass (PHP 8.4). scripts/testing/test-bash.sh: OK.

Live verification on a Pulsed Media seedbox (Debian 12) with the same one-line change in the installer: a fresh install with Sonarr, Radarr, Prowlarr, SABnzbd, Autobrr and Jellyfin (plus the #952 fix) completed. All three Servarr apps reported app-level auth configured, and the proxied URLs redirected to the login pages. Without the change, the same install aborted with Failed to build Sonarr auth payload.

🤖 Generated with Claude Code

…UrlBase

The configure step writes UrlBase=/public-<user>/<app> into config.xml before
servarr_auth_seed runs, so the prefix is live on the seed start. Unprefixed
API paths then answer an empty 307, which curl -f accepts: the readiness
probe passes, the host-config fetch writes an empty body, and json_decode
fails with "Invalid Servarr host-config JSON", aborting the install.

Add servarr_host_config_url: read UrlBase from config.xml (trailing slash
stripped, empty or missing = no prefix) and build the host-config URL under
it. servarr_auth_seed uses it for the probe, the fetch, the PUT and the
unauthenticated check.

Refs MagnaCapax#858

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant