Skip to content

[Bug] Video processing fails with "detached ArrayBuffer" error #1539

@LucaOlovrap

Description

@LucaOlovrap

Description

In the self-hosted version (v0.4.3), video processing fails immediately after the upload reaches 100%. The application fails to generate or rename the result.mp4 file in the S3 bucket (MinIO), leading to a 404 error in the browser and a "MEDIA_ELEMENT_ERROR: Format error" in the player.

Crucial Manual Test:
I confirmed that if I manually rename the file raw-upload.mp4 to result.mp4 inside the MinIO bucket, the video player starts working perfectly. This proves that the infrastructure (S3, Proxy, DNS) is correct, but the internal worker/process responsible for transcoding or renaming the file is crashing.

Reproduction

  1. Deploy Cap v0.4.3 using Docker Compose with MinIO.
  2. Set up a reverse proxy (like Caddy) for video.example.com and files.example.com.
  3. Upload a video through the dashboard.
  4. Observe the upload finishing, but the video remaining unplayable (404 on result.mp4).
  5. Check container logs to find the detached ArrayBuffer error.

Additional Context

  • Cap version: v0.4.3 (Image: ghcr.io/capsoftware/cap-web:latest)
  • Operating system, version: Linux (Ubuntu 24.04)
  • Device (optional): Server Deployment

Error Logs:

[local world] Queue operation failed: TypeError: fetch failed
    at async (.next/server/chunks/2242.js:30:10424) {
  [cause]: TypeError: Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer
      at ArrayBuffer.slice (<anonymous>)
}

Docker Compose Configuration:

services:
  cap-web:
    image: ghcr.io/capsoftware/cap-web:latest
    container_name: cap-web
    restart: unless-stopped
    environment:
      NEXTAUTH_URL: [https://video.example.com](https://video.example.com)
      WEB_URL: [https://video.example.com](https://video.example.com)
      NEXTAUTH_SECRET: "REDACTED"
      DATABASE_ENCRYPTION_KEY: "REDACTED"
      DATABASE_URL: mysql://capuser:password@db:3306/capdb
      CAP_AWS_ACCESS_KEY: minioadmin
      CAP_AWS_SECRET_KEY: "password"
      CAP_AWS_BUCKET: cap-uploads
      CAP_AWS_REGION: us-east-1
      S3_INTERNAL_ENDPOINT: http://minio:9000
      S3_PUBLIC_ENDPOINT: [https://files.example.com](https://files.example.com)
      S3_FORCE_PATH_STYLE: "true"

  db:
    image: mysql:8.0
    container_name: cap-db
    environment:
      MYSQL_ROOT_PASSWORD: "password"
      MYSQL_DATABASE: capdb
    volumes:
      - db_data:/var/lib/mysql

  minio:
    image: minio/minio
    container_name: cap-minio
    command: server /data --console-address ":9001"
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: "password"
      MINIO_SERVER_URL: "[https://files.example.com](https://files.example.com)"
      MINIO_API_CORS_ALLOW_ORIGIN: "[https://video.example.com](https://video.example.com)"
    volumes:
      - minio_data:/data

volumes:
  db_data:
  minio_data:

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions