[Bug]: After the update process, it is no longer possible to automatically reconnect to available sessions in WhatsApp Web.js Engine
Pre-flight
- [x] I searched existing issues and this isn't a duplicate
- [x] I'm on the latest released version (or noted my version below)
OpenWA version
0.11.1
Deployment
Docker Compose
Database
SQLite (default)
WhatsApp engine
whatsapp-web.js
What happened?
After updating the version, it's no longer possible to automatically reconnect to available sessions in WhatsApp Web.js Engine. I don't know why; in previous versions, sessions reconnected perfectly, but now the session reconnects only to qr_ready mode.
Steps to reproduce
Although this option is enabled: AUTO_START_SESSIONS=true After the update or restart of the server, service, or Docker, all sessions should be restarted.
Expected behavior
No response
Relevant logs
Environment / additional context
No response
Thanks for the report, and sorry for the disruption.
Before anything else: please don't re-scan the QR codes yet
Re-pairing recreates each session's folder on disk, and that folder is currently the only evidence that can tell us what actually happened. Once it's recreated we lose the ability to distinguish three very different causes. If you can leave the sessions unpaired for a little while, the two commands below will tell us which one you hit.
If you've already re-scanned one or more of them, that's fine — just say which, and run the commands anyway for any session you haven't touched.
What we've established so far
I traced the startup path, and auto-start itself is very unlikely to be the problem here. qr_ready is
only ever reported after the engine has been created, Chromium has launched, and WhatsApp Web has
loaded and presented a pairing screen. If auto-start were disabled or skipping your sessions, they
would sit at disconnected with no engine at all — you'd never see a QR.
Stored credentials being rejected also looks different: that path reports failed, not qr_ready.
So the engine is starting correctly and finding no usable credentials on disk. The question is why they're missing, and there are three possibilities that need different responses:
- OpenWA deleted them. There is a self-heal path that clears a session's stored credentials when it authenticates but never reaches runtime readiness within 90 seconds. It's meant for genuinely unrecoverable auth, but a temporarily unusable page or an incompatible WhatsApp Web build can also trip it. If this fired, the deletion is irreversible and re-pairing is the only recovery.
- whatsapp-web.js deleted them. On a WhatsApp-side logout the library removes the profile directory itself, before OpenWA gets any say. Same end state, different culprit.
- Nothing deleted anything, and the linked devices were revoked server-side by WhatsApp while your stack was down. In this case the folders are still on disk, intact.
I also want to flag honestly that I could not find any change between recent releases that would explain a regression on this path. The relevant code is byte-identical across the last few versions, and whatsapp-web.js itself is unchanged. That doesn't mean nothing broke — it means the trigger is likely environmental rather than a code change, and I need your data to pin it down.
Two commands, please paste both outputs
1) What's on disk and in the environment
docker exec openwa-api sh -c 'echo "AUTO_START=[$AUTO_START_SESSIONS] SESSION_DATA_PATH=[$SESSION_DATA_PATH] WEB_VERSION=[$WWEBJS_WEB_VERSION]"; echo "--- sessions dir ---"; ls -la /app/data/sessions'
2) What the logs say
docker compose logs openwa-api --since 168h 2>&1 \
| grep -nE "auto_start|Auto-starting|Pinning WhatsApp Web version|Initializing engine for session|QR code generated|Session disconnected:|runtime readiness|stale auth" \
| tail -100
Note that docker compose up -d --build creates a new container, so logs from before the upgrade are
gone. That's expected — the current container's logs are still the useful ones.
Three questions
- Which version did you upgrade from? This matters more than anything else here. Different source versions open up genuinely different explanations, and I don't want to chase the wrong one.
- How many sessions are affected? "All of them" reads differently if that's one session versus five — a single session points at a per-account logout, several at once points at something process-wide.
- Are you using the repository's
docker-compose.ymlunmodified, or your own compose file?
One thing worth checking on your side
The docker-compose.yml shipped in this repository does not forward AUTO_START_SESSIONS into the
container, and never has. There's no env_file: entry either, and .env files are excluded from the
build context — so setting it in .env has no effect with the bundled production compose. Only
docker-compose.dev.yml passes it through.
This is a packaging bug on our side and I'll fix it separately. It is not the cause of what you're
seeing — a missing flag would leave sessions idle at disconnected, not showing a QR — but it does
mean the flag may not have been reaching the container at all, in which case the QR you're seeing is
the aftermath of an earlier credential loss rather than a failed auto-start. The output of command 1
will show whether the variable is actually set inside the container.
The ls output alone will already narrow this down a lot: if the session-* directories are gone,
the credentials were deleted and we need to work out by whom; if they're still there and populated,
nothing local removed them and the devices were unlinked upstream.
any news? :( doesn't work anymore...
Thank you @rmyndharis for your reply.
Regarding the docker-compose.ym file I'm using, I'm using the following command to update the files:
cd /root/OpenWA
Then:
git pull
After that:
docker compose build
docker compose up -d
After that, I refreshed the main dashboard and noticed it was requesting a QR code.
The session files are complete and haven't been deleted because I've reviewed them multiple times. I'm currently on a single session, not multiple sessions.
However, I'll wait for your next update, and then I'll re-clear the QR code and provide you with the tracking log files so you can see what the problem is.
The versions that were working normally were 7 through 9.
Hi @onepay-ye, thanks for the follow-up — this is the key piece.
The fact that your session-* folder is intact and still populated rules out the two local causes I listed before. If OpenWA or whatsapp-web.js had cleared the credentials, the directory would be gone or empty. Since it is neither, nothing local removed the pairing.
That leaves the third explanation: WhatsApp revoked the linked device on its side while your stack was down. When the engine starts, it finds the folder on disk, loads it, and WhatsApp's server rejects the stored pairing — so it shows you a fresh QR. The folder survives because the revocation happened upstream, not on your disk.
A couple of things this is not:
- It is not a regression in the OpenWA code. The credential-loading path is byte-identical across the versions you moved through, and you've confirmed 0.7–0.9 were fine for you. A code regression would surface for everyone, not a single session.
- It is not the known "stale browser profile after a Chrome binary change" issue either — that one fails with an
Execution context was destroyederror and produces no QR. You're seeing a QR, which is the opposite signature.
You can re-scan now
Since the folder being intact was the evidence I needed to separate the three causes, and you've confirmed it, there is nothing more to learn from leaving it un-paired. Go ahead and scan the QR for that session — it will pair fresh and carry on. Your messages are safe; they live in the database, not the browser profile.
Still useful: the two command outputs
If you're willing, the outputs of the two commands from my earlier reply are still worth pasting — not to change the outcome, but to close the loop and confirm:
- That
AUTO_START_SESSIONSis actually set inside the container (the bundleddocker-compose.ymlforwards it now, but only if you haveAUTO_START_SESSIONS=truein your.envnext to the compose file). - That the logs show the QR arriving without any "stale auth" / credential-deletion line — which would confirm the server-side unlink and rule out the self-heal path for good.
One tip going forward
WhatsApp sometimes drops a linked device that has been disconnected for a while (~two weeks of idle is a common trigger). Two things reduce the chance of hitting this again:
- Keep the stack running and keep
AUTO_START_SESSIONS=trueso your session restores itself automatically after a restart or reboot, instead of sitting idle. - If you take the stack down for maintenance, bring it back up within a few days.
Hope this gets you back up — and the logs will firm up the diagnosis if you want to share them.
Hello again, my friend @rmyndharis
I've also noticed something important: in previous versions, when restarting Infrastructure, it would restart and wait until the health API was checked to ensure it was connected, then redirect to the control panel normally. However, in the current version, it restarts quickly and returns to the 503 Internal Server Error page. The control panel doesn't appear until I manually refresh it at least five times.
This indicates a delay in the operation of one of the Docker services or something else.
Regarding the AUTO_START_SESSIONS=true option, it works normally after restarting. The problem arises after an update when a new version is installed and Docker itself is restarted.
Anyway, if the problem occurs again, I will notify you.
Thank you very much.
HI @rmyndharis : When update to ver 12 still session disconnected and didn't restarted again i check api session :
[
{
"id": "ca90bdce-577b-4597-8cac-9591d3b78b7d",
"name": "essam-art",
"status": "disconnected",
"phone": "967770701021",
"pushName": "عصام لحلول تقنية المعلومات",
"connectedAt": "2026-07-30T14:54:43.947Z",
"lastActive": "2026-07-30T14:54:43.947Z",
"createdAt": "2026-07-03T18:40:08.000Z",
"updatedAt": "2026-07-30T14:55:04.000Z",
"lastError": null,
"engineLoaded": false
}
]
i see this value is false : "engineLoaded": false
i see this in log :
{"timestamp":"2026-07-30T14:55:12.317Z","level":"warn","context":"PluginLoaderService","message":"Plugin baileys missing manifest.json","pluginPath":"/app/data/plugins/baileys","action":"manifest_missing"}
{"timestamp":"2026-07-30T14:55:12.325Z","level":"warn","context":"PluginLoaderService","message":"Plugin whatsapp-web.js missing manifest.json","pluginPath":"/app/data/plugins/whatsapp-web.js","action":"manifest_missing"}
@onepay-ye — thank you for the follow-up, and I need to correct something I told you earlier.
My previous diagnosis was wrong
I concluded that WhatsApp had revoked the linked device server-side. That explanation predicts you would see a QR code. What you're now showing is the opposite:
"status": "disconnected",
"engineLoaded": false,
"lastError": null
engineLoaded: false means no engine was ever created for that session. Chromium never launched,
WhatsApp Web was never loaded, and your stored credentials were never read — nothing was rejected,
because nothing was attempted. That rules out the credential/revocation explanation completely, and I
should not have closed in on it before this field was available to check. Apologies for sending you
down that path.
What the evidence actually points at
Auto-start never ran for this session — and there is a concrete reason that was true for you until very recently.
The bundled docker-compose.yml did not forward AUTO_START_SESSIONS into the container until
v0.12.0 (commit a67902a, #985). On 0.11.1 and every version before it, the variable never reached
the application by any route: there is no env_file: entry, .env is not mounted into the container,
and it is excluded from the build context. The flag is only enabled on an exact string true, so it
resolved to off, and the startup hook returns before it ever looks at your sessions.
That is a packaging bug on our side, it explains the 0.7–0.11 history you described, and it is fixed in the version you have just moved to.
So why is it still failing on 0.12?
Three possibilities, and a single command separates them. Please paste the output:
docker exec openwa-api sh -c 'echo "AUTO_START=[$AUTO_START_SESSIONS]"'
AUTO_START=[true]— the flag is reaching the app, and this is a genuine bug in 0.12. In that case please also send:docker compose logs openwa-api --since 1h 2>&1 | grep -E "Auto-starting|auto_start"AUTO_START=[false]— check/root/OpenWA/.env. Our.env.exampleshipsAUTO_START_SESSIONS=false, so a file copied from it has the flag off unless that line was edited. Before 0.12 this value was inert, which is why changing it may never have appeared to matter.AUTO_START=[]— the variable isn't set in the.envsitting next to yourdocker-compose.yml. Compose substitutes it from that file specifically; exporting it in your shell will not carry.
The two plugin warnings
Unrelated to this, and harmless. /app/data/plugins/baileys and /app/data/plugins/whatsapp-web.js
are directories with no manifest.json, so the loader skips them and logs a warning each boot. Engines
are not plugins and OpenWA does not create those folders — if they were created by hand, deleting them
stops the warnings. They have no effect on session startup.
The 503 after restart
The dashboard returning 503 until several manual refreshes is a separate symptom and shouldn't be tracked in this issue. Please open a new bug report for it and I'll look at it on its own.
Thank U @rmyndharis this is results from 1st command :
root@server:~/OpenWA# docker exec openwa-api sh -c 'echo "AUTO_START=[$AUTO_START_SESSIONS]"'
AUTO_START=[]
2- second command :
docker compose logs openwa-api --since 1h 2>&1 | grep -E "Auto-starting|auto_start" that is empty
I noticed something in your statement here: in previous versions of /root/OpenWA/.env, when creating the Docker, the environment file is named .env.generated, not .env. Is this where the problem arises, that it doesn't read the value AUTO_START_SESSIONS=true (this context is inside the file)? Should I change it to .env?
# OpenWA Configuration
# Generated at 2026-07-03T19:35:58.538Z
# Managed via Dashboard > Infrastructure. Values in process env or project .env take precedence.
# =============================================================================
# CORE SETTINGS
# =============================================================================
NODE_ENV=production
API_PORT=2785
LOG_LEVEL=info # error | warn | info | debug
# Console output format. Default: json in production (containers, log aggregators),
# human-readable pretty otherwise. Force one with: json | pretty
# LOG_FORMAT=pretty
# Auto-start previously authenticated sessions on server boot
AUTO_START_SESSIONS=true
# 0 = unlimited. Set a positive integer to cap concurrently running/initializing sessions.
# Failed sessions still hold a slot until stopped (their engine stays resident); stop them to free capacity.
MAX_CONCURRENT_SESSIONS=0
# Domain Configuration
DOMAIN=localhost
# Host interface the dev compose binds the API/dashboard ports to. Defaults to 127.0.0.1
# (localhost only). Set to 0.0.0.0 to reach the dev stack from another machine (e.g. a remote
# VPS) — put a TLS reverse proxy in front for anything internet-facing (the API key is sent in
# cleartext over plain HTTP).
# BIND_HOST=0.0.0.0
# Public URLs (for startup banner and external access)
# BASE_URL=https://api.yourdomain.com
# DASHBOARD_URL=https://dashboard.yourdomain.com
# CORS Configuration: comma-separated allowed origins. The wildcard "*" is allowed
# only in development; in production it is REFUSED (cross-origin browser requests are
# blocked) — set explicit origin(s) there, e.g. https://dashboard.yourdomain.com
CORS_ORIGINS=*
DATABASE_TYPE=sqlite
ENGINE_TYPE=baileys
MINIO_BUILTIN=false
POSTGRES_BUILTIN=false
PUPPETEER_ARGS=--no-sandbox --disable-gpu
PUPPETEER_HEADLESS=true
QUEUE_ENABLED=true
REDIS_BUILTIN=true
REDIS_ENABLED=true
REDIS_HOST=redis
REDIS_PORT=6379
SESSION_DATA_PATH=./data/sessions
STORAGE_LOCAL_PATH=./data/media
STORAGE_TYPE=local
==========
The most important question is: Is the environment file read from this path: /root/OpenWA/data/.env.generated Or is the environment file data read from this path: /var/lib/docker/volumes/openwa_openwa-data/_data/.env.generated
settings in /var/lib/docker/volumes/openwa_openwa-data/_data/.env.generated:
# OpenWA Configuration
# Generated at 2026-07-30T14:55:00.318Z
# Managed via Dashboard > Infrastructure. Values in process env or project .env take precedence.
AUTO_START_SESSIONS=true
BODY_SIZE_LIMIT=25mb
CORS_ORIGINS=*
DATABASE_TYPE=sqlite
ENABLE_SWAGGER=true
ENGINE_TYPE=whatsapp-web.js
MINIO_BUILTIN=false
POSTGRES_BUILTIN=false
PUPPETEER_ARGS=--no-sandbox --disable-gpu
PUPPETEER_HEADLESS=true
QUEUE_ENABLED=false
REDIS_BUILTIN=false
REDIS_ENABLED=false
REDIS_HOST=redis
REDIS_PORT=6379
SESSION_DATA_PATH=./data/sessions
STORAGE_LOCAL_PATH=./data/media
STORAGE_TYPE=local
and this settings from docker-compose.yml:
# OpenWA - Docker Compose Configuration
# Smart Orchestration with Profiles
services:
# ===== CORE: Docker Socket Proxy (sole container with /var/run/docker.sock access) =====
docker-proxy:
image: tecnativa/docker-socket-proxy:v0.4.2
container_name: openwa-docker-proxy
restart: unless-stopped
# Only on the isolated internal network — reachable solely by openwa-api, NOT the
# dashboard or any other peer. `internal: true` also denies the proxy
# outbound access; it only needs the locally-mounted docker socket.
networks:
- internal-docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
# Minimal set that keeps DockerService (src/modules/docker/docker.service.ts) working:
# PING (health), INFO (getSystemInfo), CONTAINERS (list/inspect/create/start/stop),
# IMAGES (pull), VOLUMES (createVolume). POST is the proxy's single all-or-nothing
# method gate for non-GET requests (haproxy.cfg: `deny unless METH_GET || env(POST)`).
# Two consequences of the pinned v0.4.2 config, accepted and documented in SECURITY.md:
# - its `DELETE` env flag is dead config (never read), so it is not set here; DELETE is
# admitted to enabled paths as a side effect of POST — OpenWA itself never issues
# deletes (profile teardown is stop-only, see DockerService.stopManagedService).
# - the proxy cannot scope container-create payloads, so a compromised API container
# could create containers with host bind-mounts. If you don't use the built-in
# datastore orchestration (Dashboard > Infrastructure built-in toggles), disable
# this service entirely, e.g. via a docker-compose.override.yml:
# services:
# docker-proxy:
# profiles: ['disabled']
# DockerService then reports Docker unavailable and orchestration degrades gracefully.
CONTAINERS: 1
IMAGES: 1
VOLUMES: 1
INFO: 1
PING: 1
POST: 1
# Everything else is denied by default (AUTH, SECRETS, NETWORKS, PLUGINS, SWARM, TASKS, SERVICES, CONFIGS, NODES, DISTRIBUTIONS)
labels:
- 'com.openwa.service=docker-proxy'
- 'com.openwa.core=true'
# ===== CORE: OpenWA Backend API =====
openwa-api:
build:
context: .
dockerfile: Dockerfile
container_name: openwa-api
restart: unless-stopped
# Give the graceful drain room to complete before Docker SIGKILLs the container: the shutdown
# grace (SHUTDOWN_DELAY_MS, default 3s) plus the worst-case per-engine teardown bound (~10s) can
# exceed Docker's 10s default, which would otherwise kill Chromium mid-teardown and orphan a
# session profile. Tune down if you raise neither SHUTDOWN_DELAY_MS nor run many sessions.
stop_grace_period: 45s
# App network for datastores + the isolated network to reach
# docker-proxy (DOCKER_HOST). createService() in docker.service.ts attaches
# orchestrated containers to the literal `openwa-network`, so its name is fixed.
networks:
- openwa-network
- internal-docker
# Container hardening: Chromium runs with --no-sandbox, so the
# container itself is the confinement boundary. cap_drop ALL + a minimal re-add
# ONLY for the root entrypoint's chown + gosu privilege-drop; once gosu setuids to
# the openwa user the node/Chromium process keeps NO effective capabilities.
# read_only rootfs (Chromium's profile lives on the writable /app/data volume;
# HOME=/tmp + tmpfs absorb stray writes). no-new-privileges blocks setuid escalation.
# NOTE: requires a live single-session smoke (Chromium must launch) before merge.
security_opt:
- 'no-new-privileges:true'
cap_drop:
- ALL
cap_add:
- CHOWN # entrypoint: chown -R openwa /app/data on the named volume
- DAC_OVERRIDE # entrypoint: chown across pre-existing files
- FOWNER
- SETGID # gosu: drop to the openwa group
- SETUID # gosu: drop to the openwa user
read_only: true
tmpfs:
- /tmp
# Per-container PID ceiling (writes the cgroup pids.max). A fork-bomb guard, NOT an allocation —
# the kernel only rejects new forks once the count is reached, so a higher limit is free for
# light containers. The old default (512, from the #243 hardening pass) was picked without
# accounting for Chromium's multi-process model: whatsapp-web.js runs a full Chromium instance
# per session (browser + renderer + GPU + zygote + utilities), and WhatsApp Web is process-heavy
# (service workers/iframes), so ~4 concurrent sessions already approach 512 and a new session's
# Chromium gets killed mid-spawn — surfacing in the API as `Code: null`. 2048 fits ~8-10 wwjs
# sessions with startup-spike headroom; Baileys is single-process (no Chromium) and uses far
# less, so the higher ceiling is a no-op there. Raise via OPENWA_PIDS_LIMIT for larger fleets;
# do NOT set -1 (unlimited) — that drops the fork-bomb guard. See #636.
pids_limit: ${OPENWA_PIDS_LIMIT:-2048}
mem_limit: ${OPENWA_MEM_LIMIT:-2g} # tune up for many concurrent sessions
ports:
- '127.0.0.1:${API_PORT:-2785}:2785'
expose:
- '2785'
environment:
# Core
- NODE_ENV=${NODE_ENV:-production}
# Writable HOME on tmpfs so Chromium's HOME-relative writes don't hit the read_only rootfs
- HOME=/tmp
# Chromium resolves its home from the passwd entry (no /home/openwa), ignoring $HOME, so without
# writable, existing config/cache dirs it hard-crashes at launch on the read_only rootfs. Pin XDG
# to the tmpfs; the entrypoint pre-creates these owned by openwa. (#254)
- XDG_CONFIG_HOME=/tmp/.config
- XDG_CACHE_HOME=/tmp/.cache
- PORT=2785
- LOG_LEVEL=${LOG_LEVEL:-info}
# Database. Forwarded blank by default (`${VAR:-}`) so a dashboard switch saved to
# data/.env.generated actually applies at runtime — main.ts clears the blank (BLANK_SHADOWED_ENV_KEYS)
# and the file wins. Set any of these in your .env/host to pin it (a real value keeps top precedence
# and the dashboard control then shows "managed by environment"). First-run defaults (sqlite) are
# written to data/.env.generated by the app, so a blank stack still boots SQLite.
# NOTE: if you run the built-in Postgres MANUALLY (`docker compose --profile postgres up`) instead
# of via the dashboard, set DATABASE_TYPE=postgres, DATABASE_HOST=postgres, DATABASE_PORT=5432,
# DATABASE_USERNAME=openwa and DATABASE_PASSWORD in your .env/host — these are no longer defaulted here.
- DATABASE_TYPE=${DATABASE_TYPE:-}
- DATABASE_NAME=${DATABASE_NAME:-}
- DATABASE_HOST=${DATABASE_HOST:-}
- DATABASE_PORT=${DATABASE_PORT:-}
- DATABASE_USERNAME=${DATABASE_USERNAME:-}
# No committed default secret; blank unless the operator sets it (built-in Postgres is provisioned
# with its own credentials by the orchestrator, not via this line).
- DATABASE_PASSWORD=${DATABASE_PASSWORD:-}
# PostgreSQL schema (blank-forwarded like the other DATABASE_* keys so a dashboard-saved
# POSTGRES_SCHEMA in data/.env.generated applies; a real host value pins). Ignored for sqlite.
- POSTGRES_SCHEMA=${POSTGRES_SCHEMA:-}
- DATABASE_SYNCHRONIZE=${DATABASE_SYNCHRONIZE:-false}
# Engine. Forwarded empty by default so the dashboard (Infrastructure > Engine) selects the
# active engine via data/.env.generated (defaults to whatsapp-web.js); main.ts treats a blank
# ENGINE_TYPE as unset, so .env.generated wins. Set ENGINE_TYPE in your .env/host to pin an
# engine (e.g. baileys) — a real value flows through here and keeps top precedence.
- ENGINE_TYPE=${ENGINE_TYPE:-}
# Engine launch options (session data path, headless, browser args). Forwarded EMPTY by default
# so the dashboard (Infrastructure > Engine) selections saved to data/.env.generated apply — like
# ENGINE_TYPE above. main.ts treats a blank value as unset (.env.generated wins), and the app
# layer (configuration.ts) supplies the sane container default (headless, ./data/sessions, the
# sandbox + no-dev-shm flag set) when nothing is set anywhere. Set one on the host/.env to pin it.
- SESSION_DATA_PATH=${SESSION_DATA_PATH:-}
- PUPPETEER_HEADLESS=${PUPPETEER_HEADLESS:-}
- PUPPETEER_ARGS=${PUPPETEER_ARGS:-}
# Optional WhatsApp Web version override. DEFAULT (empty, "latest", or "auto"): OpenWA auto-resolves a
# settled build from the third-party wppconnect-team/wa-version registry and pins its remote HTML
# (fetched into the web.whatsapp.com origin without an integrity check). Set "off" to disable pinning
# and use the first-party build served by WhatsApp, or an exact version to pin a specific build.
- WWEBJS_WEB_VERSION=${WWEBJS_WEB_VERSION:-}
- WWEBJS_WEB_VERSION_REMOTE_PATH=${WWEBJS_WEB_VERSION_REMOTE_PATH:-}
# Raise whatsapp-web.js's first-boot init wait (default 30000ms) on slow boots — e.g. WSL2 or
# low-resource hosts where the QR can time out before WA Web loads. Empty = default; see
# docs/12-troubleshooting-faq.md. (Without this line the var in .env never reaches the container.)
- WWEBJS_AUTH_TIMEOUT_MS=${WWEBJS_AUTH_TIMEOUT_MS:-}
# Re-start previously authenticated sessions at boot. Opt-in: the app reads the exact string
# "true", so a blank forward (nothing set) keeps the default off. Without this line the value in
# .env never reaches the container and the flag silently does nothing.
- AUTO_START_SESSIONS=${AUTO_START_SESSIONS:-}
# Storage. Blank-forwarded (see Database note) so a dashboard local↔S3 switch applies; a real
# host value pins. Credentials use the canonical S3_ACCESS_KEY_ID / S3_SECRET_ACCESS_KEY names the
# app and dashboard write; the legacy S3_ACCESS_KEY / S3_SECRET_KEY are ALSO forwarded (and read
# as a fallback by the storage layer) so existing .env files keep working unchanged. S3_REGION is
# forwarded so external-S3 works.
- STORAGE_TYPE=${STORAGE_TYPE:-}
- STORAGE_LOCAL_PATH=${STORAGE_LOCAL_PATH:-}
- S3_ENDPOINT=${S3_ENDPOINT:-}
- S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID:-}
- S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY:-}
- S3_ACCESS_KEY=${S3_ACCESS_KEY:-}
- S3_SECRET_KEY=${S3_SECRET_KEY:-}
- S3_REGION=${S3_REGION:-}
- S3_BUCKET=${S3_BUCKET:-}
# Redis. Blank-forwarded (see Database note) so a dashboard enable/disable applies; a real host
# value pins.
- REDIS_ENABLED=${REDIS_ENABLED:-}
- REDIS_HOST=${REDIS_HOST:-}
- REDIS_PORT=${REDIS_PORT:-}
# Webhook
- WEBHOOK_TIMEOUT=${WEBHOOK_TIMEOUT:-10000}
- WEBHOOK_RETRY_DELAY=${WEBHOOK_RETRY_DELAY:-5000}
- WEBHOOK_DISPATCH_CONCURRENCY=${WEBHOOK_DISPATCH_CONCURRENCY:-16}
- WEBHOOK_DISPATCH_MAX_QUEUED=${WEBHOOK_DISPATCH_MAX_QUEUED:-1000}
# Rate limits. Blank values are cleared before lower-priority generated config is loaded.
- RATE_LIMIT_SHORT_TTL=${RATE_LIMIT_SHORT_TTL:-}
- RATE_LIMIT_SHORT_LIMIT=${RATE_LIMIT_SHORT_LIMIT:-}
- RATE_LIMIT_MEDIUM_TTL=${RATE_LIMIT_MEDIUM_TTL:-}
- RATE_LIMIT_MEDIUM_LIMIT=${RATE_LIMIT_MEDIUM_LIMIT:-}
- RATE_LIMIT_LONG_TTL=${RATE_LIMIT_LONG_TTL:-}
- RATE_LIMIT_LONG_LIMIT=${RATE_LIMIT_LONG_LIMIT:-}
# Max request body size. Base64 media sends ride in the JSON body, so the default is generous;
# raise this for large documents (e.g. BODY_SIZE_LIMIT=50mb). Blank keeps the app default of 25mb.
- BODY_SIZE_LIMIT=${BODY_SIZE_LIMIT:-}
# Plugins
- PLUGINS_DIR=${PLUGINS_DIR:-/app/data/plugins}
# Plugin install-from-URL redirect policy (ssrf-guard): off unless the exact string 'true'.
- PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS=${PLUGIN_DOWNLOAD_ALLOW_INSECURE_REDIRECTS:-false}
# Security
- API_MASTER_KEY=${API_MASTER_KEY:-}
- TRUSTED_PROXIES=${TRUSTED_PROXIES:-}
# Forward the plain-HTTP dashboard CSP override; unset preserves the application default.
- CSP_UPGRADE_INSECURE_REQUESTS=${CSP_UPGRADE_INSECURE_REQUESTS:-}
# Docker socket proxy (openwa-api never touches /var/run/docker.sock directly)
- DOCKER_HOST=tcp://docker-proxy:2375
volumes:
- openwa-data:/app/data
- ./docker-compose.yml:/app/docker-compose.yml:ro
depends_on:
docker-proxy:
condition: service_started
# Not required: lets operators disable the proxy (see the docker-proxy env comment)
# without breaking `docker compose up`. DockerService degrades gracefully without it.
required: false
postgres:
condition: service_healthy
required: false
redis:
condition: service_healthy
required: false
healthcheck:
test:
[
'CMD',
'node',
'-e',
"require('http').get('http://localhost:2785/api/health/ready', (r) => process.exit(r.statusCode === 200 ? 0 : 1))",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
labels:
- 'com.openwa.service=api'
- 'com.openwa.core=true'
# The dashboard SPA is now bundled into the openwa-api image and served by NestJS on the
# same port (2785) — there is no separate dashboard container. Reach it at the openwa-api
# port directly; put your own TLS reverse proxy (nginx/Caddy/cloud LB) in front if needed.
# ===== OPTIONAL: Built-in PostgreSQL =====
postgres:
image: postgres:16-alpine
container_name: openwa-postgres
profiles: ['postgres', 'full']
restart: unless-stopped
networks:
- openwa-network
security_opt:
- 'no-new-privileges:true'
environment:
POSTGRES_USER: ${DATABASE_USERNAME:-openwa}
# M16: no committed default secret. Empty unless the operator sets it; the postgres
# image refuses to initialize with an empty password (clear fail-fast), and the app's
# production boot guard rejects empty/placeholder secrets before startup.
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-}
POSTGRES_DB: ${DATABASE_NAME:-openwa}
# PostgreSQL schema for OpenWA's tables + migration ledger. Default 'public'. The init
# script below creates the schema (if non-public) and sets the database default search_path,
# so the built-in container works zero-config with a custom schema. Ignored when 'public'.
POSTGRES_SCHEMA: ${POSTGRES_SCHEMA:-public}
volumes:
- postgres-data:/var/lib/postgresql/data
# Runs only on first init (postgres image docker-entrypoint-initdb.d semantics): creates the
# configured schema and sets the DB default search_path. No-op for 'public'; does not re-run
# on an already-initialized volume (see the note in scripts/postgres-init-schema.sh).
- ./scripts/postgres-init-schema.sh:/docker-entrypoint-initdb.d/01-create-schema.sh:ro
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${DATABASE_USERNAME:-openwa}']
interval: 5s
timeout: 3s
retries: 5
labels:
- 'com.openwa.service=database'
- 'com.openwa.builtin=true'
# ===== OPTIONAL: Built-in Redis =====
redis:
image: redis:7-alpine
container_name: openwa-redis
profiles: ['redis', 'full']
restart: unless-stopped
networks:
- openwa-network
security_opt:
- 'no-new-privileges:true'
command: redis-server --appendonly yes
volumes:
- redis-data:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 5
labels:
- 'com.openwa.service=cache'
- 'com.openwa.builtin=true'
# ===== OPTIONAL: Built-in MinIO (S3-compatible) =====
minio:
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
container_name: openwa-minio
profiles: ['minio', 'full']
restart: unless-stopped
networks:
- openwa-network
security_opt:
- 'no-new-privileges:true'
command: server /data --console-address ":9001"
environment:
# M16: no committed default creds. MinIO refuses to start with empty root creds
# (clear fail-fast); the app's production boot guard rejects empty/placeholder secrets.
# Canonical names, matching what the app/dashboard read (legacy S3_ACCESS_KEY/S3_SECRET_KEY
# still accepted as a fallback so older .env files keep working).
MINIO_ROOT_USER: ${S3_ACCESS_KEY_ID:-${S3_ACCESS_KEY:-}}
MINIO_ROOT_PASSWORD: ${S3_SECRET_ACCESS_KEY:-${S3_SECRET_KEY:-}}
volumes:
- minio-data:/data
ports:
- '127.0.0.1:9000:9000'
- '127.0.0.1:9001:9001'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
interval: 10s
timeout: 5s
retries: 3
labels:
- 'com.openwa.service=storage'
- 'com.openwa.builtin=true'
volumes:
# Pin explicit volume names so the compose path and the Docker-API orchestration path (which uses
# the literal `openwa_<svc>-data` names in docker.service.ts) bind the SAME volume regardless of the
# compose project name — otherwise re-enabling a built-in service could mount a fresh empty volume.
openwa-data:
name: openwa_openwa-data
driver: local
postgres-data:
name: openwa_postgres-data
driver: local
redis-data:
name: openwa_redis-data
driver: local
minio-data:
name: openwa_minio-data
driver: local
networks:
# Application network — datastores and openwa-api. Keep the name `openwa-network`:
# docker.service.ts attaches orchestrated containers to it by literal name.
openwa-network:
name: openwa-network
# Isolated network for the Docker socket proxy. `internal: true` means no external
# connectivity; only openwa-api joins it, so nothing else can reach docker-proxy:2375.
internal-docker:
name: openwa-internal-docker
internal: true
@onepay-ye — I have found the cause, and I owe you a correction on what I told you last time.
What I got wrong
When your command printed AUTO_START=[], I read it as "the variable isn't set in the .env next to
your docker-compose.yml" and pointed you back at your own configuration. That reading was wrong.
AUTO_START=[] is not a sign that you forgot something. It is the signature of the bug. Your
data/.env.generated did contain AUTO_START_SESSIONS=true, and OpenWA was actively throwing that
value away.
What actually happens
docker-compose.yml forwards the variable like this:
- AUTO_START_SESSIONS=${AUTO_START_SESSIONS:-}
When nothing is set in the .env beside the compose file, that line does not omit the variable —
Compose injects it into the container present and empty. I confirmed this rather than assuming it:
on a running deployment, docker compose config renders such lines as KEY: "" and docker inspect
shows the key present with an empty value.
An empty value still occupies process.env. OpenWA then loads .env and data/.env.generated with
dotenv's override: false, which refuses to replace a key that is already present — and an empty
string counts as present. So your AUTO_START_SESSIONS=true was read from the file and then
discarded.
The flag is only enabled on the exact string true, so it resolved to off, the startup hook returned
before it looked at a single session, and your session stayed at disconnected with
engineLoaded: false and lastError: null — exactly what you posted.
OpenWA has a mechanism for precisely this problem, but its key list had drifted behind the compose
file: AUTO_START_SESSIONS was never added to it, along with seven other forwarded variables.
I verified this end to end against the published v0.12.1 image, with a data/.env.generated
containing AUTO_START_SESSIONS=true:
| Container environment | Result |
|---|---|
AUTO_START_SESSIONS injected empty (your case) |
flag resolves false — file ignored |
| variable absent entirely | flag resolves true — file applies |
| injected empty, with the fix applied | flag resolves true — file applies |
So this is a bug on our side, not a mistake in your setup.
Your direct question — which .env.generated is read?
The one in the Docker volume:
/var/lib/docker/volumes/openwa_openwa-data/_data/.env.generated
The container's working directory is /app and the openwa-data volume is mounted at /app/data, so
the application reads /app/data/.env.generated — the same file. Its own header timestamp
(2026-07-30) confirms it is the live one.
/root/OpenWA/data/.env.generated on the host is not read. The volume is mounted over that path
inside the container, so the host copy is a leftover from an earlier setup. You do not need to rename
anything to .env.
Fix you can apply right now
Add the variable to the .env beside your docker-compose.yml — that is /root/OpenWA/.env, not
the file under data/:
cd /root/OpenWA
echo 'AUTO_START_SESSIONS=true' >> .env
docker compose up -d
A real value is forwarded by Compose and keeps top precedence, so it is unaffected by this bug and
works on the version you already have. Please use docker compose up -d rather than
docker compose restart — a restart reuses the existing container with its old environment, so a new
.env value would not take effect.
Confirm it reached the application with:
docker exec openwa-api sh -c 'env | grep "^AUTO_START_SESSIONS="'
This prints the line only when the key is present, which distinguishes "empty" from "absent" —
something the echo-based command I gave you earlier could not do, since both print []. My
apologies for sending you an ambiguous check.
The fix
#1039 adds AUTO_START_SESSIONS and the seven other affected variables to that list, so a value set in
data/.env.generated is honoured again. The list is now derived from the compose files by a test, so
a forward added without its clear entry fails CI instead of shipping silently broken.
The other seven were affected the same way, in case any of them matters to you: BODY_SIZE_LIMIT,
API_MASTER_KEY, TRUSTED_PROXIES, CSP_UPGRADE_INSECURE_REQUESTS, WWEBJS_WEB_VERSION,
WWEBJS_WEB_VERSION_REMOTE_PATH and WWEBJS_AUTH_TIMEOUT_MS. Your file also sets
BODY_SIZE_LIMIT=25mb, which happens to equal the default, so that one would not have been visible.
Thank you for staying with this and for posting the contents of .env.generated — that listing is
what made the cause findable. The 503 you raised separately is tracked in #1019.
@rmyndharis Thank you, dear. The problem is now fixed.