From a006bf08bc80ad5fe9734b030f83950c75a9e3a5 Mon Sep 17 00:00:00 2001 From: Mattias Tall Date: Tue, 26 May 2026 10:06:53 +0200 Subject: [PATCH] Add node symlink to Dockerfile; expand ytdlp-test diagnostics Debian installs nodejs as /usr/bin/nodejs but yt-dlp looks for 'node'. The symlink ensures yt-dlp can find the runtime. Diagnostics now report node path/version and yt-dlp version so we can verify the environment without shelling into the container. Co-Authored-By: Claude Sonnet 4.6 --- backend/Dockerfile | 4 +++- backend/routers/settings.py | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 71b9cf0..3601400 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,7 +2,9 @@ FROM python:3.12-slim WORKDIR /app -RUN apt-get update && apt-get install -y ffmpeg gosu nodejs && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y ffmpeg gosu nodejs && \ + ln -sf /usr/bin/nodejs /usr/bin/node && \ + rm -rf /var/lib/apt/lists/* COPY backend/requirements.txt ./backend/requirements.txt RUN pip install --no-cache-dir -r backend/requirements.txt && pip install --no-cache-dir -U yt-dlp diff --git a/backend/routers/settings.py b/backend/routers/settings.py index 07ef79e..a0dcbc2 100644 --- a/backend/routers/settings.py +++ b/backend/routers/settings.py @@ -222,9 +222,26 @@ def oauth2_disable( def ytdlp_test( current_user: User = Depends(get_current_user), ): - """Run a quick yt-dlp metadata fetch on a public video and return raw output for diagnostics.""" - import subprocess + """Run a quick yt-dlp metadata fetch and environment check for diagnostics.""" + import subprocess, shutil cookie_args = ytdlp._cookie_args() + + node_path = shutil.which("node") or shutil.which("nodejs") + node_version = None + if node_path: + try: + nv = subprocess.run([node_path, "--version"], capture_output=True, text=True, timeout=5) + node_version = nv.stdout.strip() + except Exception: + pass + + yt_version = None + try: + yv = subprocess.run(["yt-dlp", "--version"], capture_output=True, text=True, timeout=5) + yt_version = yv.stdout.strip() + except Exception: + pass + result = subprocess.run( [ "yt-dlp", @@ -236,8 +253,11 @@ def ytdlp_test( capture_output=True, text=True, timeout=30, ) return { - "returncode": result.returncode, + "node_path": node_path, + "node_version": node_version, + "yt_dlp_version": yt_version, "cookie_args": cookie_args, + "returncode": result.returncode, "stdout_lines": result.stdout.splitlines()[:5], "stderr_tail": result.stderr.splitlines()[-20:], "success": result.returncode == 0,