You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Container crashes on start when DATABASE_URL is set: Cannot read properties of undefined (reading 'dbURL') #6905
HedgeDoc 1.12.0 (official image) crashes straight away when the environment has a DATABASE_URL variable, even when
CMD_DB_URL is set as well. Without DATABASE_URL the same container starts fine.
Platforms that give every app a DATABASE_URL (Heroku-style hosts, ours) cannot start HedgeDoc at all because of it.
Run the same command without "-e DATABASE_URL=...": it starts ("HTTP Server listening at 0.0.0.0:3000").
Expected behaviour
It starts, using CMD_DB_URL, the same as without DATABASE_URL.
Logs
error: uncaughtException: Cannot read properties of undefined (reading 'dbURL')
TypeError: Cannot read properties of undefined (reading 'dbURL')
at Object.<anonymous> (/hedgedoc/lib/config/index.js:153:15)
Config
No config file of our own: the image's /hedgedoc/config.json (which is {}) and only these environment variables:CMD_DB_URL=sqlite:///tmp/db.sqliteCMD_SESSION_SECRET=testDATABASE_URL=postgres://u:p@localhost:5432/db
Your Setup
Host OS: Ubuntu 24.04.3 LTS, Docker 28.5.1
NodeJS version: v24.21.0 (the one in the image)
HedgeDoc version: 1.12.0 (quay.io/hedgedoc/hedgedoc:latest, 21 Oct 2026)
Additional context
The image's config.json is {}, so in lib/config/index.js fileConfig = require(config.json)[env] is undefined.
DATABASE_URL is read by lib/config/oldEnvironment.js into the legacy setting dburl.
The "merge legacy values" loop then reads fileConfig[keys[i]] for dbURL (line ~153) while fileConfig is undefined.
A guard like (fileConfig || {})[keys[i]], or defaulting fileConfig to {}, should fix it.
Workaround for now: don't pass DATABASE_URL to the container, only CMD_DB_URL.
Activity