bug: envvars.update() throws "ReferenceError: name is not defined" outside a task context

Aperta
#4,264 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@hastyy ci sta già lavorando.

Dal 9/10/2026.

  • #4291 di @ANSHSINGH050404 — chiusa senza merge
  • #4431 di @karandhaodiyal28-hash — chiusa senza merge
  • #4903 di @claxman — chiusa senza merge
  • #4925 di @Tyagiquamar — chiusa senza merge
  • #4968 di @kaiizer777 — chiusa senza merge

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
node.js, typescript
Ambito
api

Direzione di ricerca

Start in src/v3/envvars.ts at update() and compare the non-task-context argument resolution with the working del, retrieve, and create methods. Check for an existing regression test for calling update() outside a task context; done means that call no longer throws and the env var update succeeds.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
16.5k
Fork
1.5k
Merge medio
1g 15h
PR unite (30g)
17

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di triggerdotdev/trigger.dev

Tutte le issue di triggerdotdev/trigger.dev

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.