Env Info
System:
OS: macOS 26.5.2
CPU: (15) arm64 Apple M5 Pro
Memory: 2.33 GB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.7.0 - /Users/patrick/.nvm/versions/node/v24.7.0/bin/node
npm: 11.5.1 - /Users/patrick/.nvm/versions/node/v24.7.0/bin/npm
pnpm: 11.1.1 - /opt/homebrew/bin/pnpm
Description
Calling envvars.update(projectRef, slug, name, params) from outside a task run (a plain Node script / CI deploy step) always throws ReferenceError: name is not defined. envvars.create, del, retrieve, and list all work fine from the same context.
SDK version
@trigger.dev/sdk 4.5.0. The code path looks unchanged in the published dist, so 4.5.x is likely affected too — please confirm on the latest.
Reproduction
import { envvars } from "@trigger.dev/sdk";
// TRIGGER_ACCESS_TOKEN set in env; NOT running inside a task
await envvars.update("proj_xxx", "staging", "MY_VAR", { value: "hello" });
ReferenceError: name is not defined
at Module.update (@trigger.dev/sdk/src/v3/envvars.ts:343:5)
Root cause
update(projectRefOrName, slugOrParams, nameOrRequestOptions, params, requestOptions) — the non-task-context branch resolves the name as:
$name = name; // ❌ there is no `name` parameter here; the positional param is `nameOrRequestOptions`
Unlike del/retrieve (whose third positional parameter is literally named name), update's third parameter is nameOrRequestOptions, so name is not in scope and the call throws. The in-task-context branch is correct.
For reference, the compiled dist/commonjs/v3/envvars.js update() non-task branch:
$projectRef = projectRefOrName;
$slug = slugOrParams;
$name = name; // <- undefined reference
$params = params;
Suggested fix
$name = nameOrRequestOptions;
(matching how $projectRef / $slug / $params are resolved from the positional args in the same branch).
Impact / workaround
envvars.update() is unusable from the management-API path (e.g. updating an env var from a deploy script). Workaround: envvars.del() followed by envvars.create(). create, del, retrieve, and list are unaffected.
Env Info
Description
Calling
envvars.update(projectRef, slug, name, params)from outside a task run (a plain Node script / CI deploy step) always throwsReferenceError: name is not defined.envvars.create,del,retrieve, andlistall work fine from the same context.SDK version
@trigger.dev/sdk4.5.0. The code path looks unchanged in the publisheddist, so 4.5.x is likely affected too — please confirm on the latest.Reproduction
Root cause
update(projectRefOrName, slugOrParams, nameOrRequestOptions, params, requestOptions)— the non-task-context branch resolves the name as:Unlike
del/retrieve(whose third positional parameter is literally namedname),update's third parameter isnameOrRequestOptions, sonameis not in scope and the call throws. The in-task-context branch is correct.For reference, the compiled
dist/commonjs/v3/envvars.jsupdate()non-task branch:Suggested fix
(matching how
$projectRef/$slug/$paramsare resolved from the positional args in the same branch).Impact / workaround
envvars.update()is unusable from the management-API path (e.g. updating an env var from a deploy script). Workaround:envvars.del()followed byenvvars.create().create,del,retrieve, andlistare unaffected.