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
Environment variables defined in the env: block of a DAG (or in base.yaml) resolve to empty strings when the DAG is executed via dagu enqueue, but resolve correctly when executed via dagu start. This applies to both ${VAR} expansion and backtick command substitution (`echo $VAR`).
Version
Dagu 2.3.6
Platform: Linux (EKS pod with IAM role credentials)
dagu start executes the DAG in the CLI process, which inherits the full shell environment. All ${VAR} expansions and backtick commands resolve correctly.
dagu enqueue sends the DAG to the start-all server daemon. The server applies system environment variable filtering, which only whitelists specific prefixes (DAGU_*, DAG_*, LC_*, HOME, PATH, SHELL, etc.). Variables like AWS_* are filtered out.
The filtering affects all resolution methods: ${VAR}, `echo $VAR`, and `printenv VAR`. The variable is simply not present in the worker's process environment.
Whitelisted variables like HOME resolve correctly in both modes.
Defining the variables in base.yaml's env: block does not help — the same filtering applies during base config resolution.
Expected behavior
Variables explicitly referenced in a DAG's env: block (e.g., AWS_WEB_IDENTITY_TOKEN_FILE: "${AWS_WEB_IDENTITY_TOKEN_FILE}") should resolve identically regardless of whether the DAG is started via dagu start or dagu enqueue. If the variable exists in the server process's environment (confirmed via /proc/<pid>/environ), it should be available for expansion.
Workaround
We currently source filtered variables from /proc/1/environ in step commands:
if [ -r /proc/1/environ ];thenwhile IFS='='read -r -d '' key value;docase"$key"in AWS_*) export"$key=$value" ;; esacdone< /proc/1/environ
fi
Suggestion
Consider one of:
Allow env: block references to bypass the filter — if a DAG author explicitly writes AWS_FOO: "${AWS_FOO}", they're opting in to that variable. The filter should only apply to implicit/automatic propagation.
Description
Environment variables defined in the
env:block of a DAG (or inbase.yaml) resolve to empty strings when the DAG is executed viadagu enqueue, but resolve correctly when executed viadagu start. This applies to both${VAR}expansion and backtick command substitution (`echo $VAR`).Version
Reproduction
DAG definition
Confirm the variable exists in the host environment
dagu start(works correctly)Output:
dagu enqueue(variables lost)Output:
Analysis
dagu startexecutes the DAG in the CLI process, which inherits the full shell environment. All${VAR}expansions and backtick commands resolve correctly.dagu enqueuesends the DAG to thestart-allserver daemon. The server applies system environment variable filtering, which only whitelists specific prefixes (DAGU_*,DAG_*,LC_*,HOME,PATH,SHELL, etc.). Variables likeAWS_*are filtered out.${VAR},`echo $VAR`, and`printenv VAR`. The variable is simply not present in the worker's process environment.HOMEresolve correctly in both modes.base.yaml'senv:block does not help — the same filtering applies during base config resolution.Expected behavior
Variables explicitly referenced in a DAG's
env:block (e.g.,AWS_WEB_IDENTITY_TOKEN_FILE: "${AWS_WEB_IDENTITY_TOKEN_FILE}") should resolve identically regardless of whether the DAG is started viadagu startordagu enqueue. If the variable exists in the server process's environment (confirmed via/proc/<pid>/environ), it should be available for expansion.Workaround
We currently source filtered variables from
/proc/1/environin step commands:Suggestion
Consider one of:
env:block references to bypass the filter — if a DAG author explicitly writesAWS_FOO: "${AWS_FOO}", they're opting in to that variable. The filter should only apply to implicit/automatic propagation.allowed_env_prefixesserver config option so admins can addAWS_*,DOCKER_*, etc. (related to Is the DOCKER_HOST environment variable no longer effective in dagu? #1843 whereDOCKER_HOSTwas individually added).dagu startanddagu enqueuebehave consistently — the current divergence is surprising and hard to debug.Related issues
DOCKER_HOSTnot effective (same filtering)envprovider broken (same filtering)