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
159 stars 9 forks source link

Error on fetchServerVersion #44

Open karl007 opened 1 week ago

karl007 commented 1 week ago

Seems there are something broken in the version check:

# docker run -v "/mnt/user/bilder/:/mnt/bilder" -e API_URL="http://10.9.8.7:8080" -e API_KEY="9ht[..]Duk" -e ROOT_PATH="/mnt/bilder" -e INSECURE="true" -e ALBUM_LEVELS="1,5" -e ALBUM_SEPARATOR=" > " -e LOG_LEVEL="DEBUG" salvoxia/immich-folder-album-creator:latest /script/immich_auto_album.sh
time=2024-09-08T15:45:14.837+00:00 level=DEBUG msg=root_path = ['/mnt/bilder']
time=2024-09-08T15:45:14.837+00:00 level=DEBUG msg=root_url = http://10.9.8.7:8080
time=2024-09-08T15:45:14.837+00:00 level=DEBUG msg=api_key = 9ht[..]Duk
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=number_of_images_per_request = 2000
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=number_of_assets_to_fetch_per_request = 5000
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=unattended = False
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=album_levels = 1,5
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=album_level_separator =  >
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=album_order = False
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=insecure = True
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=ignore =
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=mode = CREATE
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=delete_confirm = False
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=is_docker = 1
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=share_with = None
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=share_role = viewer
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=sync_mode = 0
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=find_assets_in_albums = False
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=valid album_levels range argument supplied
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=album_levels_start_level = 1
time=2024-09-08T15:45:14.838+00:00 level=DEBUG msg=album_levels_end_level = 5
time=2024-09-08T15:45:14.840+00:00 level=DEBUG msg=Starting new HTTP connection (1): 10.9.8.7:8080
time=2024-09-08T15:45:14.841+00:00 level=DEBUG msg=http://10.9.8.7:8080 "GET /server-info/version HTTP/11" 200 6112
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/script/immich_auto_album.py", line 538, in <module>
    version = fetchServerVersion()
              ^^^^^^^^^^^^^^^^^^^^
  File "/script/immich_auto_album.py", line 271, in fetchServerVersion
    version = r.json()
              ^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Immich are the latest Docker (1.113), and the API request for server-version returns a valid json response:

# curl -L 'http://10.9.8.7:8080/api/server-info/version' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'x-api-key: 9ht[..]Duk'
{"major":1,"minor":113,"patch":0}

I also installed curl within the docker from above and make the request from within this docker - same result, so it is not a network issue or so.

Is this a bug or what did I wrong?

Salvoxia commented 1 week ago

Hi,

API_URL must include /api at the end, it is not added automatically.

Best Regards, Salvoxia