[BUG] 502 Bad Gateway #1385

Closed
opened 2026-02-05 01:35:49 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @MouseMan32 on GitHub (Sep 30, 2023).

The bug

The Bug

Similar to this issue, but this is a brand new install and I have never been able to get anything working with this container. For reference, I am a noob when it comes to docker containers, so I may have made a simple mistake in my setup.

The Error:

immich_server | Error: Cannot find module '/usr/src/app/start.sh'
immich_server | at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
immich_server | at Function.Module._load (node:internal/modules/cjs/loader:778:27)
immich_server | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
immich_server | at node:internal/main/run_main_module:17:47 {
immich_server | code: 'MODULE_NOT_FOUND',
immich_server | requireStack: []
immich_server | }

The OS that Immich Server is running on

Debian

Version of Immich Server

latest

Version of Immich Mobile App

latest

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

version: "2"

networks:
  http_network:
    external: true

services: 
 immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:latest
    command: [ "start.sh", "immich" ]
    volumes:
      - /mnt/data/media/Photos:/usr/src/app/upload
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:latest
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - /mnt/data/media/Photos:/usr/src/app/upload
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:latest
    volumes:
      - /mnt/data/media/Photos/model-cache:/cache
    env_file:
      - .env
    restart: always

  immich-web:
    container_name: immich_web
    image: ghcr.io/immich-app/immich-web:latest
    env_file:
      - .env
    restart: always

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd
    environment:
      - TYPESENSE_API_KEY=D0vA22emXvzJnhRnwlouUNGbR8oevhfo
      - TYPESENSE_DATA_DIR=/data
      # remove this to get debug messages
      - GLOG_minloglevel=1
    volumes:
      - /mnt/data/media/Photos/tsdata:/data
    restart: always

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

  database:
    container_name: immich_postgres
    image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - /mnt/data/media/Photos/pgdata:/var/lib/postgresql/data
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: ghcr.io/immich-app/immich-proxy:latest
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    depends_on:
      - immich-server
      - immich-web
    restart: always

volumes:
  pgdata:
  model-cache:
  tsdata:

Your .env content

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

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=some-random-text
DB_PASSWORD=postgres

# 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.
2.
3.
...

Additional information

I have tried docker-compose down and docker-compose up as well as rm the container and re-pulling to no avail.

Originally created by @MouseMan32 on GitHub (Sep 30, 2023). ### The bug ### The Bug Similar to [this](https://github.com/immich-app/immich/issues/3672) issue, but this is a brand new install and I have never been able to get anything working with this container. For reference, I am a noob when it comes to docker containers, so I may have made a simple mistake in my setup. The Error: immich_server | Error: Cannot find module '/usr/src/app/start.sh' immich_server | at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) immich_server | at Function.Module._load (node:internal/modules/cjs/loader:778:27) immich_server | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) immich_server | at node:internal/main/run_main_module:17:47 { immich_server | code: 'MODULE_NOT_FOUND', immich_server | requireStack: [] immich_server | } ### The OS that Immich Server is running on Debian ### Version of Immich Server latest ### Version of Immich Mobile App latest ### Platform with the issue - [X] Server - [X] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML version: "2" networks: http_network: external: true services: immich-server: container_name: immich_server image: ghcr.io/immich-app/immich-server:latest command: [ "start.sh", "immich" ] volumes: - /mnt/data/media/Photos:/usr/src/app/upload env_file: - .env depends_on: - redis - database - typesense restart: always immich-microservices: container_name: immich_microservices image: ghcr.io/immich-app/immich-server:latest # extends: # file: hwaccel.yml # service: hwaccel command: [ "start.sh", "microservices" ] volumes: - /mnt/data/media/Photos:/usr/src/app/upload env_file: - .env depends_on: - redis - database - typesense restart: always immich-machine-learning: container_name: immich_machine_learning image: ghcr.io/immich-app/immich-machine-learning:latest volumes: - /mnt/data/media/Photos/model-cache:/cache env_file: - .env restart: always immich-web: container_name: immich_web image: ghcr.io/immich-app/immich-web:latest env_file: - .env restart: always typesense: container_name: immich_typesense image: typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd environment: - TYPESENSE_API_KEY=D0vA22emXvzJnhRnwlouUNGbR8oevhfo - TYPESENSE_DATA_DIR=/data # remove this to get debug messages - GLOG_minloglevel=1 volumes: - /mnt/data/media/Photos/tsdata:/data restart: always redis: container_name: immich_redis image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3 restart: always database: container_name: immich_postgres image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441 env_file: - .env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} volumes: - /mnt/data/media/Photos/pgdata:/var/lib/postgresql/data restart: always immich-proxy: container_name: immich_proxy image: ghcr.io/immich-app/immich-proxy:latest environment: # Make sure these values get passed through from the env file - IMMICH_SERVER_URL - IMMICH_WEB_URL ports: - 2283:8080 depends_on: - immich-server - immich-web restart: always volumes: pgdata: model-cache: tsdata: ``` ### Your .env content ```Shell # The Immich version to use. You can pin this to a specific version like "v1.71.0" IMMICH_VERSION=latest # Connection secrets for postgres and typesense. You should change these to random passwords TYPESENSE_API_KEY=some-random-text DB_PASSWORD=postgres # 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 ```bash 1. 2. 3. ... ``` ### Additional information I have tried docker-compose down and docker-compose up as well as rm the container and re-pulling to no avail.
Author
Owner

@jrasm91 commented on GitHub (Sep 30, 2023):

Try using the release tag instead of latest.

@jrasm91 commented on GitHub (Sep 30, 2023): Try using the `release` tag instead of latest.
Author
Owner

@MouseMan32 commented on GitHub (Sep 30, 2023):

Hey! That solved an error! Now I am getting this error from running docker logs immich_server, as well as receive a "connect ECONNREFUSED 172.18.0.12:3001" error when connecting locally.

[Nest] 7  - 09/30/2023, 12:59:34 AM   ERROR [ExceptionHandler] password authentication failed for user "postgres"
error: password authentication failed for user "postgres"
    at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:514:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [NestFactory] Starting Nest application...
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +36ms
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] ConfigModule dependencies initialized +4ms
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 8  - 09/30/2023, 12:59:36 AM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 8  - 09/30/2023, 12:59:36 AM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...

@MouseMan32 commented on GitHub (Sep 30, 2023): Hey! That solved an error! Now I am getting this error from running docker logs immich_server, as well as receive a "connect ECONNREFUSED 172.18.0.12:3001" error when connecting locally. ``` [Nest] 7 - 09/30/2023, 12:59:34 AM ERROR [ExceptionHandler] password authentication failed for user "postgres" error: password authentication failed for user "postgres" at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98) at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29) at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38) at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42) at Socket.emit (node:events:514:28) at addChunk (node:internal/streams/readable:324:12) at readableAddChunk (node:internal/streams/readable:297:9) at Readable.push (node:internal/streams/readable:234:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [NestFactory] Starting Nest application... [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized +36ms [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] ConfigModule dependencies initialized +4ms [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] BullModule dependencies initialized +1ms [Nest] 8 - 09/30/2023, 12:59:36 AM LOG [InstanceLoader] BullModule dependencies initialized +0ms [Nest] 8 - 09/30/2023, 12:59:36 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... ```
Author
Owner

@jrasm91 commented on GitHub (Sep 30, 2023):

The database password is only set the first time it starts up.

If it is a brand new install, you should delete the database and recreate it. (Delete pgdata volume via docker compose down -v)

Make sure the DB_PASSWORD environment variable in the .env is also passed to the postgres container in your compose.

@jrasm91 commented on GitHub (Sep 30, 2023): The database password is only set the first time it starts up. If it is a brand new install, you should delete the database and recreate it. (Delete pgdata volume via `docker compose down -v`) Make sure the DB_PASSWORD environment variable in the .env is also passed to the postgres container in your compose.
Author
Owner

@MouseMan32 commented on GitHub (Sep 30, 2023):

The database password is only set the first time it starts up.

If it is a brand new install, you should delete the database and recreate it. (Delete pgdata volume via docker compose down -v)

Make sure the DB_PASSWORD environment variable in the .env is also passed to the postgres container in your compose.

This was the answer! Thank you so much!

@MouseMan32 commented on GitHub (Sep 30, 2023): > The database password is only set the first time it starts up. > > If it is a brand new install, you should delete the database and recreate it. (Delete pgdata volume via `docker compose down -v`) > > Make sure the DB_PASSWORD environment variable in the .env is also passed to the postgres container in your compose. This was the answer! Thank you so much!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#1385