immich-app / immich

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

Websocket connect error after updating to 1.95.1 #7282

Closed eygraber closed 9 months ago

eygraber commented 9 months ago

The bug

Websocket Connect Error Error: websocket error
    at Nt.onError (full-screen-modal.9WfeJgNa.js:1:9514)
    at ws.onerror (full-screen-modal.9WfeJgNa.js:1:16091)
23:33:04.049 full-screen-modal.9WfeJgNa.js:1 WebSocket connection to 'wss://<my host>/api/socket.io/?EIO=4&transport=websocket' failed: 
doOpen @ full-screen-modal.9WfeJgNa.js:1
open @ full-screen-modal.9WfeJgNa.js:1
open @ full-screen-modal.9WfeJgNa.js:1
v @ full-screen-modal.9WfeJgNa.js:1
open @ full-screen-modal.9WfeJgNa.js:1
(anonymous) @ full-screen-modal.9WfeJgNa.js:1
23:33:04.049 

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

v1.95.1

Version of Immich Mobile App

N/A

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    user: 1000:1001
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    ports:
      - "2283:3001"
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    user: 1000:1001
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - /disks/storage/immich/volumes/geocoding:/usr/src/app/.reverse-geocoding-dump
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    user: 1000:1001
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - /disks/storage/immich/volumes/model-cache:/cache
    env_file:
      - .env
    restart: always

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

  database:
    user: 1000:1001
    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:
      - /disks/storage/immich/volumes/pgdata:/var/lib/postgresql/data
    restart: always

Your .env content

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

PUID=1000
GUID=1001

# The location where your uploaded files are stored
UPLOAD_LOCATION=/disks/storage/immich/library

# 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
DB_PASSWORD=...

TZ=America/New_York

# 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

1. Open the website

Additional information

No response

eygraber commented 9 months ago

Not sure if related, but the following warning shows up in the logs:

WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
alextran1502 commented 9 months ago

Does it happen if you use local IP?

eygraber commented 9 months ago

No, it doesn't happen is I use local IP

alextran1502 commented 9 months ago

Try restart your proxy, it probably caches something

eygraber commented 9 months ago

I restarted it, and the issue still happens. Nothing suspicious in the proxy logs either.

alextran1502 commented 9 months ago

Then try clear your browser cache

michelheusschen commented 9 months ago

Maybe your reverse proxy isn't configured to correctly forward websocket connections. Are you using nginx by chance? If so, please take a look at the nginx example config and make sure your configuration is correct.

eygraber commented 9 months ago

It should be. It was working fine until I updated Immich.

dwiprawira commented 9 months ago

I don't know whether it is related or not. But I cannot access Immich, and the Docker Compose logs show this error:

immich_microservices     | [Nest] 7  - 02/21/2024, 6:29:35 AM     LOG [CommunicationRepository] Initialized websocket server
immich_microservices     | /usr/src/app/dist/domain/database/database.service.js:137
immich_microservices     |             throw new Error(`
immich_microservices     |                   ^
immich_microservices     |
immich_microservices     | Error:
immich_microservices     |         The pgvecto.rs extension version is 0.1.11, but Immich only supports 0.2.0 and later minor releases.
immich_microservices     |
immich_microservices     |         If the Postgres instance already has a compatible version installed, Immich may not have the necessary permissions to activate it.
immich_microservices     |         In this case, please run 'ALTER EXTENSION UPDATE vectors' manually as a superuser.
immich_microservices     |         See https://immich.app/docs/guides/database-queries for how to query the database.
immich_microservices     |
immich_microservices     |         Otherwise, please update the version of pgvecto.rs in the Postgres instance to a compatible version.
immich_microservices     |     at DatabaseService.assertVectorExtension (/usr/src/app/dist/domain/database/database.service.js:137:19)
immich_microservices     |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_microservices     |     at async /usr/src/app/dist/domain/database/database.service.js:39:13
immich_microservices     |     at async /usr/src/app/dist/infra/repositories/database.repository.js:185:23
immich_microservices     |
immich_microservices     | Node.js v20.11.0
AirP0WeR commented 9 months ago

Same issue for me, Docker compose.

[Nest] 7  - 02/21/2024, 6:44:13 AM     LOG [CommunicationRepository] Initialized websocket server
/usr/src/app/dist/domain/database/database.service.js:137
            throw new Error(`

In DB instance

2024-02-21 06:51:18.285 UTC [40] ERROR:  pgvecto.rs: The index is not existing in the background worker.
    ADVICE: Drop or rebuild the index.
2024-02-21 06:51:18.285 UTC [40] STATEMENT:  
              SELECT idx_status
              FROM pg_vector_index_stat
              WHERE indexname = $1

Update:

Finaly I update my DB image to image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0

Restart all services an it works!

njzhenghao commented 9 months ago

same problem ,help

Dominion0815 commented 9 months ago

same here?!?

I cannot login with apache2 config https://immich.app/docs/administration/reverse-proxy/#apache-example-config Without apache2 as reverse proxy login is possible.

MikeDeltaHH commented 9 months ago

Same issue for me, Docker compose.

[Nest] 7  - 02/21/2024, 6:44:13 AM     LOG [CommunicationRepository] Initialized websocket server
/usr/src/app/dist/domain/database/database.service.js:137
            throw new Error(`

In DB instance

2024-02-21 06:51:18.285 UTC [40] ERROR:  pgvecto.rs: The index is not existing in the background worker.
  ADVICE: Drop or rebuild the index.
2024-02-21 06:51:18.285 UTC [40] STATEMENT:  
            SELECT idx_status
            FROM pg_vector_index_stat
            WHERE indexname = $1

Update:

Finaly I update my DB image to image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0

Restart all services an it works!

Same error and offered solution to change the image and restart the both docker container works for me, thanks!

hukoeth commented 9 months ago

same here?!?

I cannot login with apache2 config https://immich.app/docs/administration/reverse-proxy/#apache-example-config Without apache2 as reverse proxy login is possible.

I had the same issue. In my apache configuration I had a directive to add HttpOnly to most cookies. PR #6765 adds some code to access cookies in JavaScript and so HttpOnly Cookies don't work.

Dominion0815 commented 9 months ago

same here?!? I cannot login with apache2 config https://immich.app/docs/administration/reverse-proxy/#apache-example-config Without apache2 as reverse proxy login is possible.

I had the same issue. In my apache configuration I had a directive to add HttpOnly to most cookies. PR #6765 adds some code to access cookies in JavaScript and so HttpOnly Cookies don't work.

Deactivating "Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure" has helped ... thanks

eygraber commented 9 months ago

None of those solutions address my issue. I had already updated the docker image, and I don't use Apache. Not sure why this was closed 🤔

eygraber commented 9 months ago

Looks like the nginx docs were updated - https://immich.app/docs/administration/reverse-proxy#nginx-example-config

It would be nice if stuff like this was called out in the release notes.

jrasm91 commented 9 months ago

Looks like the nginx docs were updated - https://immich.app/docs/administration/reverse-proxy#nginx-example-config

It would be nice if stuff like this was called out in the release notes.

https://github.com/immich-app/immich/releases/tag/v1.94.0

eygraber commented 9 months ago

Huh interesting. Not sure how I missed that, and also missed the error in 1.94.0 ¯\_(ツ)_/¯