Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic local URL switching frequently fails #15220

Open
1 of 3 tasks
ShawnTheBeachy opened this issue Jan 10, 2025 · 8 comments
Open
1 of 3 tasks

Automatic local URL switching frequently fails #15220

ShawnTheBeachy opened this issue Jan 10, 2025 · 8 comments

Comments

@ShawnTheBeachy
Copy link

ShawnTheBeachy commented Jan 10, 2025

The bug

I have automatic URL switching set up when I am on my home network. I have the following setup:

External network: Only one entry: my externally accessible URL.
Local network: My Wi-Fi name and local URL

I'm not able to reproduce it reliably, but probably 8 times out of 10 when I open the iOS app not on my local network, it still tries to use the local URL. Restarting the app usually switches it to the remote URL.

The OS that Immich Server is running on

Docker on Windows

Version of Immich Server

v1.124.2

Version of Immich Mobile App

v1.124.0 build.187

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

#
# 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}
    extends:
      file: hwaccel.transcoding.yml
      service: nvenc
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - '2283:2283'
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-cuda
    extends:
      file: hwaccel.ml.yml
      service: cuda
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:eaba718fecd1196d88533de7ba49bf903ad33664a92debb24660a922ecd9cac8
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: docker.io/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:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    ports:
      - '127.0.0.1:5435:5432'
    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',
      ]
    restart: always

volumes:
  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=D:/immich/uploads
# The location where your database files are stored
DB_DATA_LOCATION=D:/immich/.postgres

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=Etc/US

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

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=******

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

Reproduction steps

  1. Open the app off my local network.
  2. Notice that Immich can't connect to the server. Check the URL, see that it is trying to use the local URL.
  3. Reopen the app. Check the URL, see that it is (usually) fixed. Repeat step 3 if not.

Relevant log output

No response

Additional information

Immich's "Location" permissions are set to Always.

@alextran1502
Copy link
Contributor

when I open the iOS app not on my local network

Do you know if this is happening when you are on mobile data or on a different WIFI network?

@ShawnTheBeachy
Copy link
Author

ShawnTheBeachy commented Jan 10, 2025

@alextran1502 It happens both ways. The other day I had it happen on mobile data, and today I had it happen while on my work Wi-Fi. Wish I could give more info, but I can't seem to reproduce it reliably...

@alextran1502
Copy link
Contributor

Thanks, I will investigate this

@ShawnTheBeachy
Copy link
Author

@alextran1502 Not sure if this is helpful, but I just noticed it actually goes the other way, too. I just opened Immich on my local network, and it continued using the remote URL until an app restart.

@alextran1502
Copy link
Contributor

@ShawnTheBeachy can you let me know where do you confirm the connection info?

@ShawnTheBeachy
Copy link
Author

@alextran1502 I'm tapping on my profile photo in the top right corner and checking the "Server URL" in the popup.

@alextran1502
Copy link
Contributor

Ah that is not necessarily reflecting the correct info. There is a caching bug of showing the value. However, it is using the correct url

@ShawnTheBeachy
Copy link
Author

ShawnTheBeachy commented Jan 11, 2025

@alextran1502 Ah I see! Perhaps there’s overlap with some other bug, then? I just encountered this issue again and I did some testing; the app was non-functional until I did a restart and it showed the correct (remote) URL. Any attempts to refresh the library, view albums, search, etc. just showed a spinner indefinitely. I also checked the logs, and it did say “Resuming session at [my local URL]” even though I wasn’t on my Wi-Fi.

EDIT: Looking at the logs more, it does actually look like the sync was succeeding, though. Perhaps some parts of the UI just aren’t using the correct URL or something…?

@ShawnTheBeachy ShawnTheBeachy changed the title Automatica local URL switching frequently fails Automatic local URL switching frequently fails Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants