[Api:Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client #3504

Closed
opened 2026-02-05 08:48:12 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @MFYDev on GitHub (Jun 13, 2024).

The bug

[Api:Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

v1.106.3

Version of Immich Mobile App

v1.106.3

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

version: "3.8"

name: immich

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

  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: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine
    restart: always

  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: always

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=**pathredacted**

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

PUBLIC_LOGIN_PAGE_MESSAGE="redacted"

Reproduction steps

1.upgrade and try to play a video

Relevant log output

[Nest] 16  - 06/13/2024, 3:11:51 PM   ERROR [Api:Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:659:11)
    at ServerResponse.header (/usr/src/app/node_modules/express/lib/response.js:795:10)
    at sendFile (/usr/src/app/dist/utils/file.js:61:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AssetMediaController.playAssetVideo (/usr/src/app/dist/controllers/asset-media.controller.js:60:9)~83gskcgk] Failed to play asset video
[Nest] 16  - 06/13/2024, 3:11:51 PM   ERROR [Api:Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:659:11)
    at ServerResponse.header (/usr/src/app/node_modules/express/lib/response.js:795:10)
    at sendFile (/usr/src/app/dist/utils/file.js:61:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AssetMediaController.playAssetVideo (/usr/src/app/dist/controllers/asset-media.controller.js:60:9)~83gskcgk] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

Additional information

No response

Originally created by @MFYDev on GitHub (Jun 13, 2024). ### The bug [Api:Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client ### The OS that Immich Server is running on Ubuntu 22.04 ### Version of Immich Server v1.106.3 ### Version of Immich Mobile App v1.106.3 ### Platform with the issue - [X] Server - [X] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML version: "3.8" name: immich services: immich-server: container_name: immich_server image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} ports: - 2283:3001 volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro env_file: - .env depends_on: - redis - database restart: always 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: always redis: container_name: immich_redis image: redis:6.2-alpine restart: always 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: always volumes: pgdata: model-cache: ``` ### Your .env content ```Shell # 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=**pathredacted** # 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=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 PUBLIC_LOGIN_PAGE_MESSAGE="redacted" ``` ### Reproduction steps ```bash 1.upgrade and try to play a video ``` ### Relevant log output ```shell [Nest] 16 - 06/13/2024, 3:11:51 PM ERROR [Api:Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (node:_http_outgoing:659:11) at ServerResponse.header (/usr/src/app/node_modules/express/lib/response.js:795:10) at sendFile (/usr/src/app/dist/utils/file.js:61:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AssetMediaController.playAssetVideo (/usr/src/app/dist/controllers/asset-media.controller.js:60:9)~83gskcgk] Failed to play asset video [Nest] 16 - 06/13/2024, 3:11:51 PM ERROR [Api:Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (node:_http_outgoing:659:11) at ServerResponse.header (/usr/src/app/node_modules/express/lib/response.js:795:10) at sendFile (/usr/src/app/dist/utils/file.js:61:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AssetMediaController.playAssetVideo (/usr/src/app/dist/controllers/asset-media.controller.js:60:9)~83gskcgk] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client ``` ### Additional information _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#3504