immich-app / immich

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

Unable to login with app, ApiException 404 #9719

Closed meowmeows closed 3 months ago

meowmeows commented 3 months ago

The bug

Unable to login using Android or iOS app using either OAuth or password.

Web works fine on windows/iOS.

Same behavior whether on internal LAN, external, or external Cloudflare proxied.

The OS that Immich Server is running on

Debian 12

Version of Immich Server

main (317f736679645483ca2a0efc62ce23336668f845c1465da3a4c9ecdbe36dd523)

Version of Immich Mobile App

1.105.0

Platform with the issue

Your docker-compose.yml content

# https://immich.app/docs/install/portainer
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

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

    command: ['start.sh', 'immich']
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ${SYNCTHING_LOCATION}:/usr/src/app/external
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    ports: #no longer applicable since macvlan
      - 3001:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: ['start.sh', 'microservices']
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ${SYNCTHING_LOCATION}:/usr/src/app/external
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - stack.env
    restart: always

  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:84882e87b54734154586e5f8abd4dce69fe7311315e2fc6d67c29614c8de2672
    restart: always

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    restart: always
    command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]

volumes:
  model-cache:

networks:
  immichvlan:
    driver: macvlan
    driver_opts:
      parent: ens18
    ipam:
      config:
        - subnet: "192.168.1.0/24"
          ip_range: "192.168.1.240/28"
          gateway: "192.168.1.1"

Your .env content

UPLOAD_LOCATION=/mnt/x/immich/library
DB_DATA_LOCATION=/mnt/x/immich/postgres
IMMICH_VERSION=v1.105.1
DB_PASSWORD=X
DB_USERNAME=X
DB_DATABASE_NAME=immich
SYNCTHING_LOCATION=/mnt/x/syncthing/external

Reproduction steps

I'm not sure when this started occurring. This is a very fresh install and I was able to get OAuth working. At some point I disabled passwords and dabbled around, moving to the main tag of immich-server in order to utilize IMMICH_PORT. I no longer need IMMICH_PORT. 
Going back to 1.105.1 is impossible as the database seems incompatible 
"usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219
            throw new QueryFailedError_1.QueryFailedError(query, parameters, err);
                  ^
QueryFailedError: relation "system_config" does not exist"

Relevant log output

Error getting user information from the server [API EXCEPTION]

ApiException 404: {"message":"Cannot GET /api/user/me","error":"Not Found","statusCode":404}

#0      UserApi.getMyUserInfo (package:openapi/api/user_api.dart:289)
<asynchronous suspension>
#1      AuthenticationNotifier.setSuccessLoginInfo (package:immich_mobile/providers/authentication.provider.dart:183)
<asynchronous suspension>
#2      LoginForm.build.login (package:immich_mobile/widgets/forms/login_form.dart:156)
<asynchronous suspension>

Additional information

Starting with a fresh database (empty postgres path) resolves the issue, but obviously not preferable.

alextran1502 commented 3 months ago

You are using the main tag which is the development branch and has unreleased work in there. Please resort to use the release tag.

zackpollard commented 3 months ago

If you don't have backups and don't want to reset your database, you may need to just wait for the next release where the upgrade will complete and everything will be back to working.