Salvoxia / immich-folder-album-creator

Automatically create and populate albums in Immich from a folder structure in external libraries
https://hub.docker.com/r/salvoxia/immich-folder-album-creator
222 stars 13 forks source link

Wrong Immich version detected #42

Closed carlosjfcasero closed 2 months ago

carlosjfcasero commented 2 months ago

Hi. As suggested in documentation, my docker compose has two album-folder-creation services:

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    ...

  immich-folder-album-creator-offline-asset-removal:
    container_name: immich_folder_album_creator_offline_asset_removal
    image: salvoxia/immich-folder-album-creator:latest
    restart: unless-stopped
    environment:
      API_URL: https://tld/api
      # Admin User API Key
      API_KEY: XXX
      ROOT_PATH: /thisIsADummyPathThatDoesNotExist
      CRON_EXPRESSION: "0 * * * *"
      TZ: Europe/Madrid
      # Regularly trigger offline asset removal
      SYNC_MODE: "2"
      IGNORE: "Álbumes:Revisar:Uploaded"
      ALBUM_SEPARATOR: " - "
      ALBUM_LEVELS: "2"

  immich-folder-album-creator:
    container_name: immich_folder_album_creator
    image: salvoxia/immich-folder-album-creator:latest
    restart: unless-stopped
    environment:
      API_URL: http://tld/api
      API_KEY: XXX
      ROOT_PATH: /usr/src/app/nextcloud
      # Run 10 minutes past the hour to give Offline Asset Removal time to work
      CRON_EXPRESSION: "10 * * * *"
      TZ: Europe/Madrid
      # Delete empty albums after each run
      SYNC_MODE: "1"
      IGNORE: "Álbumes:Revisar:Uploaded"
      ALBUM_SEPARATOR: " - "
      ALBUM_LEVELS: "2"
...

In immich_folder_album_creator_offline_asset_removal logs everything looks fine:

time=2024-09-05T14:00:01.291+02:00 level=INFO msg=Detected Immich server version 1.113.1
time=2024-09-05T14:00:01.294+02:00 level=INFO msg=Requesting all assets
time=2024-09-05T14:00:04.676+02:00 level=INFO msg=4268 photos found
time=2024-09-05T14:00:04.676+02:00 level=INFO msg=Sorting assets to corresponding albums using folder name
time=2024-09-05T14:00:04.680+02:00 level=INFO msg=0 albums identified
time=2024-09-05T14:00:04.681+02:00 level=INFO msg=Album list: []
time=2024-09-05T14:00:04.681+02:00 level=INFO msg=Listing existing albums on immich
time=2024-09-05T14:00:10.234+02:00 level=INFO msg=526 existing albums identified
time=2024-09-05T14:00:10.234+02:00 level=INFO msg=Creating albums if needed
time=2024-09-05T14:00:10.234+02:00 level=INFO msg=0 albums created
time=2024-09-05T14:00:10.235+02:00 level=INFO msg=Adding assets to albums
time=2024-09-05T14:00:10.235+02:00 level=INFO msg=Trigger offline asset removal
time=2024-09-05T14:00:10.474+02:00 level=INFO msg=Done!

However, in immich_folder_album_creator logs I have following errors:

time=2024-09-05T14:10:01.454+02:00 level=INFO msg=Detected Immich server version 1.105.1 or older
time=2024-09-05T14:10:01.456+02:00 level=CRITICAL msg=This script only works with Immich Server v1.106.0 and newer! Update Immich Server or use script version 0.8.1!

My Immich version is 1.113.1

Salvoxia commented 2 months ago

Hmm, for immich_folder_album_creator the API_URL is set to http://tld/api, but for immich-folder-album-creator-offline-asset-removal it is set to https://tld/api (http vs https). Is it the same way in your actual docker-compose.yml file and could that have an influence on that, i.e. is your Immich API reachable both via https as well as over http?

carlosjfcasero commented 2 months ago

OMG, that was the issue. Since logs didn't mention anything related to connectivity I didn't realize. Thanks for the point

Salvoxia commented 2 months ago

I understand your confusion. The problem is that the API endpoint that is now used to get the Immich API version did not exist prior to version 1.106.1, so the script actually expects an error for older Immich versions. So it's difficult to tell older versions and actual errors apart.
What I can do is update the error message to include the possibility communication issues with the API.