<#7676 [BUG] [v2] `Trigger(env_vars=...)` are reco...
# flyte-github
a
#7676 [BUG] [v2]
Trigger(env_vars=...)
are recorded in the trigger spec but never reach the task pod
Issue created by earlybard Describe the bug Env vars declared on a trigger —
flyte.Trigger(..., env_vars={...})
— are serialized into the deployed trigger's
run_spec.envs
, but runs fired by the trigger do not receive them: the pod never sees the variables. Task-spec env vars (
TaskEnvironment(env_vars=...)
) are not affected — they land in
container.env
and are present in the pod for both client-launched and trigger-fired runs. This contradicts the documented behavior. The
Trigger
docstring (
flyte/_trigger.py
) says:
:param env_vars: Environment variables for triggered runs (overrides the task's configured values).
and the triggers user guide lists
env_vars
as a supported
Trigger
parameter with a worked example. Steps to reproduce import os import flyte env = flyte.TaskEnvironment("envdump", env_vars={"FROM_TASK_SPEC": "1"}) @env.task( triggers=flyte.Trigger( "envdump-minutely", automation=flyte.Cron("* * * * *"), env_vars={"FROM_TRIGGER": "1"} ) ) async def dump() -> str: return repr({k: v for k, v in os.environ.items() if k.startswith("FROM_")}) flyte.deploy(env) 1. Deploy: the returned trigger spec contains
run_spec.envs = {FROM_TRIGGER: "1"}
. 2. Wait for the trigger to fire. The run's output is
{'FROM_TASK_SPEC': '1'}
—
FROM_TRIGGER
is missing. Expected behavior Runs fired by a trigger have the trigger's
env_vars
set in the pod, overriding task-spec vars per key (consistent with client-injected run-level envs). Environment • flyte SDK 2.5.9 (Python 3.14), self-hosted Flyte v2 backend Related The
ModuleNotFoundError
failures on trigger-fired runs of
src/
-layout projects are a separate bug:
flyte deploy
never records
_F_SYS_PATH
(see flyte-sys-path-deploy-bug-report.md). Because trigger env vars are dropped, a trigger can't be used to patch that gap either — but
TaskEnvironment(env_vars={"_F_SYS_PATH": ...})
works. flyteorg/flyte