Title: bug: envvars.update() throws "ReferenceError: name is not defined" outside a task context · Issue #4264 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: bug: envvars.update() throws "ReferenceError: name is not defined" outside a task context · Issue #4264 · triggerdotdev/trigger.dev
X Title: bug: envvars.update() throws "ReferenceError: name is not defined" outside a task context · Issue #4264 · triggerdotdev/trigger.dev
Description: 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/v...
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/issues/4264
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: envvars.update() throws \"ReferenceError: name is not defined\" outside a task context","articleBody":"## Env Info\n\n```\n System:\n OS: macOS 26.5.2\n CPU: (15) arm64 Apple M5 Pro\n Memory: 2.33 GB / 48.00 GB\n Shell: 5.9 - /bin/zsh\n Binaries:\n Node: 24.7.0 - /Users/patrick/.nvm/versions/node/v24.7.0/bin/node\n npm: 11.5.1 - /Users/patrick/.nvm/versions/node/v24.7.0/bin/npm\n pnpm: 11.1.1 - /opt/homebrew/bin/pnpm\n```\n\n## Description\n\nCalling `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.\n\n## SDK version\n\n`@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.\n\n## Reproduction\n\n```ts\nimport { envvars } from \"@trigger.dev/sdk\";\n\n// TRIGGER_ACCESS_TOKEN set in env; NOT running inside a task\nawait envvars.update(\"proj_xxx\", \"staging\", \"MY_VAR\", { value: \"hello\" });\n```\n\n```\nReferenceError: name is not defined\n at Module.update (@trigger.dev/sdk/src/v3/envvars.ts:343:5)\n```\n\n## Root cause\n\n`update(projectRefOrName, slugOrParams, nameOrRequestOptions, params, requestOptions)` — the non-task-context branch resolves the name as:\n\n```ts\n$name = name; // ❌ there is no `name` parameter here; the positional param is `nameOrRequestOptions`\n```\n\nUnlike `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.\n\nFor reference, the compiled `dist/commonjs/v3/envvars.js` `update()` non-task branch:\n\n```js\n$projectRef = projectRefOrName;\n$slug = slugOrParams;\n$name = name; // \u003c- undefined reference\n$params = params;\n```\n\n## Suggested fix\n\n```ts\n$name = nameOrRequestOptions;\n```\n\n(matching how `$projectRef` / `$slug` / `$params` are resolved from the positional args in the same branch).\n\n## Impact / workaround\n\n`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.\n","author":{"url":"https://github.com/patrick-fintary","@type":"Person","name":"patrick-fintary"},"datePublished":"2026-07-15T04:46:50Z","url":"https://github.com/triggerdotdev/trigger.dev/issues/4264"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cd490871-d48e-d589-b48b-980ac167a70a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDD6:1E77:A25AA1:EED9F2:6AFB0714 |
| html-safe-nonce | b9ae0f725d9a503a6a391bb16afc78a17a97262caab1cb906d7bd0408c96ec64 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREQ2OjFFNzc6QTI1QUExOkVFRDlGMjo2QUZCMDcxNCIsInZpc2l0b3JfaWQiOiIyNzE0MTA5NTQ1NDY1NzEwMzU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2be59b6bbbce8662ff813d4c917c5eb3252ea968a82103ea4936440f4a40abed |
| hovercard-subject-tag | issue:4889364923 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/triggerdotdev/trigger.dev/4264/issue_layout |
| twitter:image | https://opengraph.githubassets.com/181fb8ef8956414cde311396aeec69adcadecc05e641b2d3a0b5a204c3f92f21/triggerdotdev/trigger.dev/issues/4264 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/181fb8ef8956414cde311396aeec69adcadecc05e641b2d3a0b5a204c3f92f21/triggerdotdev/trigger.dev/issues/4264 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | patrick-fintary |
| hostname | github.com |
| expected-hostname | github.com |
| None | 76fb13cb43f1834708971f45a9cfcab5df3177a7582086613d7cdc6e98c4bfde |
| turbo-cache-control | no-preview |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | afc998826cdd963c8f91a96ae5372809ab5e296b |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width