immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
39.44k stars 1.87k forks source link

CLI broken after latest updates #10267

Closed MrBananaPants closed 1 month ago

MrBananaPants commented 1 month ago

The bug

I use the CLI (installed through npm) to upload images to Immich. However, the most recent version brought a lot of API endpoints changes. I assume this is the cause of the CLI not working anymore.

The cli is version 2.1.0

When I run immich upload --recursive ~/Photos/, I get the following output:

Crawling for assets...
Checking assets | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 0% | ETA: 0s | 0/51 assets
file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:9798
  throw new y(e.status, e.data, e.headers);
        ^

y [Error]: Error: 404
    at Object.l [as ok] (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:9798:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UploadCommand.checkHashes (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:18454:27)
    at async UploadCommand.getStatus (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:18421:27)
    at async UploadCommand.checkAssets (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:18261:31)
    at async UploadCommand.run (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:18219:44)
    at async Command.<anonymous> (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:18501:3) {
  status: 404,
  data: {
    message: 'Cannot POST /api/asset/bulk-upload-check',
    error: 'Not Found',
    statusCode: 404,
    correlationId: '67msicmk'
  },
  headers: Headers {
    [Symbol(headers list)]: HeadersList {
      cookies: null,
      [Symbol(headers map)]: Map(8) {
        'x-powered-by' => { name: 'x-powered-by', value: 'Express' },
        'x-immich-cid' => { name: 'x-immich-cid', value: '67msicmk' },
        'content-type' => {
          name: 'content-type',
          value: 'application/json; charset=utf-8'
        },
        'content-length' => { name: 'content-length', value: '118' },
        'etag' => { name: 'etag', value: '"76-5zV4V39UK3LA6angi1+7gWhstyA"' },
        'date' => { name: 'date', value: 'Thu, 13 Jun 2024 09:47:45 GMT' },
        'connection' => { name: 'connection', value: 'keep-alive' },
        'keep-alive' => { name: 'keep-alive', value: 'timeout=5' }
      },
      [Symbol(headers map sorted)]: null
    },
    [Symbol(guard)]: 'immutable',
    [Symbol(realm)]: null
  }
}

Node.js v20.14.0

Logging in also doesn't work:

joran@joran:~/immich-app$ immich login-key http://192.168.0.35:2283/api Az9LRUVpJ4gEG9wwC1Zc11ddnBu9EP9wuDQ4q8Ny0
Logging in to http://192.168.0.35:2283/api
file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:10254
      throw new LoginError(`Failed to connect to server ${instanceUrl}: ${error2.message}`);
            ^

LoginError: Failed to connect to server http://192.168.0.35:2283/api: Error: 404
    at file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:10254:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SessionService.login (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:10253:22)
    at async LoginCommand.run (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:10305:5)
    at async Command.<anonymous> (file:///usr/local/lib/node_modules/@immich/cli/dist/index.js:18507:3)

Node.js v20.14.0

The OS that Immich Server is running on

Ubuntu 24.04 LTS x86_64

Version of Immich Server

v1.106.3

Version of Immich Mobile App

not applicable

Platform with the issue

Your docker-compose.yml content

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: no
    ports:
      - 2283:3001

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: no

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3
    restart: no

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: no

volumes:
  pgdata:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/home/joran/Seagate_4TB/immich-app-backup

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=[REDACTED]
DB_PASSWORD=[REDACTED]

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

Reproduction steps

Just run `immich upload --recursive ~/Photos/`

Relevant log output

No response

Additional information

No response

bo0tzz commented 1 month ago

You need to update the cli