Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(docker): Chrome for Testing on amd64 for K8s SIGTRAP; arm64 keeps Debian chromium

_okarun99a9bfd563ff
diff --git a/CHANGELOG.md b/CHANGELOG.md
index faec4378c..5fac0cafc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Fixed
+
+- **Debian Chromium SIGTRAP crash in Kubernetes.** The `Dockerfile` previously installed the OS-level `chromium` package from Debian 12. When run as a non-root user in strict Docker/Kubernetes environments, this package consistently crashed at startup with `Code: null` and `Trace/breakpoint trap (core dumped)`. On amd64 the `Dockerfile` now downloads **Chrome for Testing** via Puppeteer during the build phase (avoiding the Debian package's SIGTRAP); arm64 keeps Debian's `chromium`, since Chrome for Testing publishes no linux-arm64 build. Both resolve to a single `PUPPETEER_EXECUTABLE_PATH` symlink. This resolves the persistent browser launch failures on restricted environments without requiring insecure workarounds like `--no-zygote` or disabling Seccomp/AppArmor. Thanks @muhfalihr.
+
### Added
- **Global message search across sessions.** `GET /api/search` finds messages across all sessions through an open `SearchProvider` contract, with a built-in database full-text provider (PostgreSQL `tsvector`/`GIN`, SQLite `FTS5`) as the zero-dependency default — no external service required. Search works out of the box on both SQLite and PostgreSQL and survives repeated dialect switching and export/import round-trips; a non-FTS5 SQLite build skips the index gracefully and the route returns `501` instead of crashing boot. Set `SEARCH_ENABLED=false` to disable the route and module entirely (the index is DB-maintained per-write regardless, at negligible in-process cost). Advanced backends (typo-tolerance, CJK word-segmentation, large-scale relevance) will be available as provider plugins.
diff --git a/Dockerfile b/Dockerfile
index 53d70a100..a7091e356 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -45,9 +45,14 @@ RUN npm run build && npm run dashboard:ci -- --include=dev && npm run dashboard:
# ===== Stage 2: Production =====
FROM docker.io/node:22-slim AS production
-# Install Chrome/Chromium and required dependencies
+# Chrome for Testing has no linux-arm64 build, and Puppeteer's chromium snapshot
+# is x86_64-only on Linux too. So: amd64 uses Chrome for Testing (downloaded below)
+# to avoid the Debian chromium package's K8s SIGTRAP under strict non-root/seccomp;
+# arm64 installs Debian's chromium instead (it ships a native arm64 build). Both
+# resolve to the same /usr/local/bin/puppeteer-chrome symlink below.
+ARG TARGETARCH
RUN apt-get update && apt-get install -y \
- chromium \
+ $([ "$TARGETARCH" = arm64 ] && echo chromium) \
fonts-liberation \
libappindicator3-1 \
libasound2 \
@@ -71,8 +76,7 @@ RUN apt-get update && apt-get install -y \
procps \
&& rm -rf /var/lib/apt/lists/*
-# Set Chrome executable path for Puppeteer
-ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
+# Set Puppeteer to skip automatic download during npm install (we download it explicitly below)
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
# Create app user for security
@@ -86,6 +90,21 @@ COPY package*.json ./
# Install production dependencies only
RUN npm ci --omit=dev && npm cache clean --force
+# amd64: download Chrome for Testing via Puppeteer and symlink it.
+# arm64: use Debian's chromium installed above (CfT has no linux-arm64 build).
+# test -n guards against a future path mismatch failing loudly instead of shipping a broken image.
+RUN if [ "$TARGETARCH" = arm64 ]; then \
+ ln -s /usr/bin/chromium /usr/local/bin/puppeteer-chrome; \
+ else \
+ mkdir -p /opt/puppeteer && \
+ PUPPETEER_CACHE_DIR=/opt/puppeteer ./node_modules/.bin/puppeteer browsers install '[email protected]' && \
+ chown -R openwa:openwa /opt/puppeteer && \
+ chrome_path=$(find /opt/puppeteer/chrome/linux*/chrome-linux64/chrome | head -n 1) && \
+ test -n "$chrome_path" && \
+ ln -s "$chrome_path" /usr/local/bin/puppeteer-chrome; \
+ fi
+ENV PUPPETEER_EXECUTABLE_PATH=/usr/local/bin/puppeteer-chrome
+
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
diff --git a/docs/08-development-guidelines.md b/docs/08-development-guidelines.md
index 14859684e..8addc03d2 100644
--- a/docs/08-development-guidelines.md
+++ b/docs/08-development-guidelines.md
@@ -1001,7 +1001,7 @@ export class EngineTeardownService {
**Causes & Solutions:**
1. **Chrome/Puppeteer issue**
- - Ensure Chromium is installed: `which chromium`
+ - Ensure Chrome for Testing is installed: `ls /usr/local/bin/puppeteer-chrome`
- Check Puppeteer args: `--no-sandbox --disable-setuid-sandbox`
2. **Previous session data corrupted**
diff --git a/docs/10-devops-infrastructure.md b/docs/10-devops-infrastructure.md
index 981787333..2f6b749ca 100644
--- a/docs/10-devops-infrastructure.md
+++ b/docs/10-devops-infrastructure.md
@@ -51,9 +51,8 @@ RUN npm run build
# Runtime stage
FROM node:22-slim
-# Install Chrome dependencies
+# Install Chrome dependencies (avoid Debian's chromium package due to SIGTRAP in non-root)
RUN apt-get update && apt-get install -y \
- chromium \
curl \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
@@ -61,12 +60,24 @@ RUN apt-get update && apt-get install -y \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
+ libnss3 \
+ libnspr4 \
+ libatk-bridge2.0-0 \
+ libatk1.0-0 \
+ libcups2 \
+ libdrm2 \
+ libxkbcommon0 \
+ libxcomposite1 \
+ libxdamage1 \
+ libxfixes3 \
+ libxrandr2 \
+ libgbm1 \
+ libasound2 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
-# Set Chrome path for Puppeteer
+# Set Puppeteer skip download (we install it dynamically later)
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
-ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
# Create app directory
WORKDIR /app
@@ -75,14 +86,26 @@ WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
+# NOTE: Chrome for Testing has no linux-arm64 build, so this example targets linux/amd64.
+# For arm64, install Debian's `chromium` package and point PUPPETEER_EXECUTABLE_PATH to
+# /usr/bin/chromium — see the repo's Dockerfile for the mixed multi-arch build.
+# Download Chrome for Testing via Puppeteer and point ENV to it
+RUN mkdir -p /opt/puppeteer && \
+ PUPPETEER_CACHE_DIR=/opt/puppeteer ./node_modules/.bin/puppeteer browsers install '[email protected]' && \
+ chrome_path=$(find /opt/puppeteer/chrome/linux*/chrome-linux64/chrome | head -n 1) && \
+ test -n "$chrome_path" && \
+ ln -s "$chrome_path" /usr/local/bin/puppeteer-chrome
+ENV PUPPETEER_EXECUTABLE_PATH=/usr/local/bin/puppeteer-chrome
+
# Copy build output
COPY --from=build /app/dist ./dist
# Create non-root user
RUN groupadd -r openwa && useradd -r -g openwa openwa
-RUN chown -R openwa:openwa /app
+RUN chown -R openwa:openwa /app /opt/puppeteer
USER openwa
+
# Expose port
EXPOSE 2785
diff --git a/docs/12-troubleshooting-faq.md b/docs/12-troubleshooting-faq.md
index f912da331..989604c46 100644
--- a/docs/12-troubleshooting-faq.md
+++ b/docs/12-troubleshooting-faq.md
@@ -333,9 +333,13 @@ specific failure (Chromium can't resolve its home directory on a read-only rootf
immediately above this one for the fix. The bundled image already handles this; it only resurfaces on a
custom container that drops the `XDG_CONFIG_HOME` / `XDG_CACHE_HOME` setup or the writable `/tmp` tmpfs.
+**Cause D — Debian 12 OS Chromium SIGTRAP in non-root Pods.**
+If `Code: null` happens on Kubernetes, and the host kernel logs or `dmesg` shows `Trace/breakpoint trap (core dumped)` with exit code 133, the underlying Debian 12 OS `chromium` package has crashed due to strict non-root or seccomp constraints (even with `--no-zygote` or `Unconfined` seccomp).
+*Fix:* On amd64, do not use the `chromium` package from Debian's `apt` — it SIGTRAPs under strict non-root/seccomp. Instead, download Chrome for Testing via Puppeteer during the Docker build (`./node_modules/.bin/puppeteer browsers install '[email protected]'`) and point `PUPPETEER_EXECUTABLE_PATH` to it. (Chrome for Testing has no linux-arm64 build, so arm64 keeps Debian's `chromium`, which ships a native arm64 binary.) The official `Dockerfile` implements this mixed approach.
+
**Quick triage:** run `docker stats openwa-api`, click **Start**, and watch which resource spikes toward its
limit the instant before the failure — that tells you A vs B. If neither moves and you see the crashpad
-`--database` line, it's C.
+`--database` line, it's C. If running in K8s as non-root with the Debian `chromium` package, it is likely D.
### Issue: Frequent Disconnections