• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support Troubleshooting Networking & Access Library Refresh Not Working on [HttpPost("Library/Refresh")]

     
    • 0 Vote(s) - 0 Average

    Library Refresh Not Working on [HttpPost("Library/Refresh")]

    haw
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 Mar
    Reputation: 0
    Country:United States
    #1
    2024-03-25, 01:45 AM
    I've been trying to troubleshoot an external app connectivity to a new Windows 11 install of Jellyfin this weekend, particularly an HTTP post to trigger a library refresh.

    As I understand, it should work for http://192.168.1.30:8096/library/refresh?api_key=xxxxx

    This fails for me.

    I have no issues with network reachability for devices on either end. I can file transfer and ping both directions. I've got media folder sources at the other device, which Jellyfin reads fine. My issue appears to be with the Jellyfin server config.

    When I'm authenticated in the browser for Jellyfin, I should be able to navigate to http://192.168.1.30:8096/library/refresh and trigger a library refresh with a 204 response for library scan started, right?

    https://github.com/jellyfin/jellyfin/blo...troller.cs

    /// <summary>
        /// Starts a library scan.
        /// </summary>
        /// <response code="204">Library scan started.</response>
        /// <returns>A <see cref="NoContentResult"/>.</returns>
        [HttpPost("Library/Refresh")]
        [Authorize(Policy = Policies.RequiresElevation)]
        [ProducesResponseType(StatusCodes.Status204NoContent)]
        public async Task<ActionResult> RefreshLibrary()
        {
            try
            {
                await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error refreshing library");
            }

            return NoContent();
        }

    When I use this URL, I get a 405 failure. I'm not sure where to look to investigate this issue further. Have I missed a setting to trigger refreshes in the web server? Am I using the wrong URL path?

    My log file shows the request and session close but I only get the 405 error in the browser:

    [2024-03-24 19:59:00.552 -04:00] [INF] [21] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "192.168.1.169" request
    [2024-03-24 20:01:02.629 -04:00] [INF] [44] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "192.168.1.169" closed
    [2024-03-24 20:16:26.797 -04:00] [INF] [86] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "127.0.0.1" request
    [2024-03-24 20:16:42.135 -04:00] [INF] [17] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "127.0.0.1" closed

    To be clear, I cannot trigger a refresh from (1) the remote app with the API key or (2) from an authenticated session directly in the browser.

    I'd be happy to be the idiot who missed a setting somewhere but I'm at a loss here. Any guidance would be appreciated.
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #2
    2024-03-25, 03:59 PM
    Keep in mind that you are looking at the master branch, which is currently the unreleased 10.9. If your setup is running 10.8.X you will need to switch to the 10.8.Z branch and make sure that your API call matches what is in the code there.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    haw
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 Mar
    Reputation: 0
    Country:United States
    #3
    2024-03-25, 09:22 PM (This post was last modified: 2024-03-25, 09:23 PM by haw. Edited 1 time in total.)
    Thanks.

    To follow up, I see identical code in the 10.8.z branch. I'm currently running 10.8.13.

    https://github.com/jellyfin/jellyfin/blo...troller.cs
    haw
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 Mar
    Reputation: 0
    Country:United States
    #4
    2024-03-28, 01:44 AM
    So, this is still driving me mad. Here's the API documentation telling me that this should work: https://api.jellyfin.org/#tag/Library/op...eshLibrary
    grunwalski
    Offline

    Junior Member

    Posts: 9
    Threads: 2
    Joined: 2023 Dec
    Reputation: 0
    #5
    2024-07-11, 03:04 PM (This post was last modified: 2024-07-11, 03:27 PM by grunwalski. Edited 1 time in total.)
    Same problem here. I could be just clueless, but I tried a lot by now.


    Running in v10.9.7 in Docker

    From a container in the same stack every one of these is met with a 401 / Request completley sent off:

    Code:
    curl -v -X POST "http://172.29.0.10:8096/Library/Refresh" -H "Authorization: ApiKeyCopiedFromJellyfin"
    curl -v -X POST "http://172.29.0.10:8096/Library/Refresh" -H "Authorization: MediaBrowser ApiKeyCopiedFromJellyfin"
    curl -v -X POST "http://172.29.0.10:8096/Library/Refresh" --user ApiKeyCopiedFromJellyfin:



    Responses all come with the same result:

    Code:
    *  Trying 172.29.0.10:8096...
    * Connected to 172.29.0.10 (172.29.0.10) port 8096
    > POST /Library/Refresh HTTP/1.1
    > Host: 172.29.0.10:8096
    > User-Agent: curl/8.8.0
    > Accept: */*
    > Authorization: MediaBrowser ApiKeyCopiedFromJellyfin
    >
    * Request completely sent off
    < HTTP/1.1 401 Unauthorized
    < Content-Length: 0
    < Date: Thu, 11 Jul 2024 14:10:05 GMT
    < Server: Kestrel
    < X-Response-Time-ms: 0.2319
    <
    * Connection #0 to host 172.29.0.10 left intact


    And Jellyfin only logs
    Code:
    [INF] [42] Jellyfin.Api.Auth.CustomAuthenticationHandler: AuthenticationScheme: CustomAuthentication was challenged.


    Right now, even with *arr connect webhooks, I cannot trigger a library refresh.
    Any ideas would be greatly appreciated. I am out of them.


    [edit:]just be sure, i've found posts where there was this in the logs. but i only get the challenged entry "CustomAuthentication was not authenticated. Failure message: Invalid token." Cn.
    niels
    Offline

    Core Team

    Posts: 248
    Threads: 4
    Joined: 2023 Jun
    Reputation: 12
    Country:Netherlands
    #6
    2024-07-11, 03:23 PM
    Your authorization header is formatted incorrectly.

    See https://gist.github.com/nielsvanvelzen/e...1ffaf12a6f
    [Image: GitHub%20Sponsors-grey?logo=github]
    grunwalski
    Offline

    Junior Member

    Posts: 9
    Threads: 2
    Joined: 2023 Dec
    Reputation: 0
    #7
    2024-07-11, 04:06 PM
    THANKS. This was a clear case of: once you stop doing it wrong, it just works.
    « Next Oldest | Next Newest »

    Users browsing this thread: 2 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode