Functions params: a param with a default still fails deploy in --non-interactive mode
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- nodejs, typescript
- Ambito
- cli
Direzione di ricerca
Inizia in src/deploy/functions/params.ts intorno a resolveParams (righe 427-454), dove i parametri mancanti dai file dotenv vengono aggiunti alla lista dei prompt e la modalità non interattiva lancia un'eccezione. Leggi la gestione dei valori predefiniti di ParamBase sopra, poi controlla la copertura esistente in src/deploy/functions/params.spec.ts. Fatto significa che un deploy non interattivo risolve valori predefiniti CEL letterali o già risolvibili e genera errori solo per i parametri ancora privi di un valore, con un test che esercita il caso del valore predefinito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[REQUIRED] Environment info
firebase-tools: 15.35.0 (the same code is still on main at bd1d9f9)
Platform: Windows 11, Node.js 22, firebase-functions 7.4.0
[REQUIRED] Test case
A 2nd gen function with a string param that has a default, and no .env file in the functions folder:
import { defineString } from 'firebase-functions/params';
import { onRequest } from 'firebase-functions/https';
const greeting = defineString('GREETING', { default: 'hello' });
export const hi = onRequest((req, res) => {
res.send(greeting.value());
});
[REQUIRED] Steps to reproduce
firebase deploy --only functions --non-interactive
[REQUIRED] Expected behavior
The deploy uses the param's default (GREETING=hello). The docs (https://firebase.google.com/docs/functions/config-env) say the CLI prompts for a param during deployment "if they are not present in those files and no default is set", so a param with a default shouldn't need a prompt, and therefore shouldn't fail when the CLI can't prompt. The ParamBase type in params.ts says the same: "Default value. If not provided, a param must be supplied."
[REQUIRED] Actual behavior
Error: In non-interactive mode but have no value for the following environment variables: GREETING
To continue, either run `firebase deploy` with an interactive terminal, or add values to a dotenv file.
In interactive mode the CLI still prompts for it, with the default prefilled.
resolveParams sends every param that is not in a dotenv file to the prompt list, regardless of default, and in non-interactive mode throws if that list isn't empty:
https://github.com/firebase/firebase-tools/blob/bd1d9f917594e3f9c2c4aa57fe0d2df71d6aaaa6/src/deploy/functions/params.ts#L427-L454
I hit this in a real project (param BUSINESS_TIME_ZONE with a default, deployed from a script); the workaround was adding the value to functions/.env.
Possible fix: in non-interactive mode, resolve params that have a default (literal, or a CEL expression that can already be resolved) to that default, and only throw for the ones left without a value. I'd be happy to send a PR with tests if that's the intended behavior.
- Lingua principale
- TypeScript
- Stelle
- 4.5k
- Fork
- 1.3k
- Merge medio
- 3g 9h
- PR unite (30g)
- 99
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di firebase/firebase-tools
-
Raising memory on an existing 2nd gen function keeps the old CPU, so deploys above 4GiB failForse già presa @anjalimishra-0007 l’ha presa 2 giorni fa. Apertaapi: functions reproducible type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
firebase/firebase-tools#11492 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[firebase-vscode] CLI version check reads the version from the debug banner, because logSetup() leaks DEBUG=true into the spawned `firebase --version` (follow-up to #10874)Forse già presa @abhiramshaji-cyber l’ha presa 20 giorni fa. Apertareproducible type: bug VSCode Extension
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
firebase/firebase-tools#11363 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
[MCP] Crashlytics tools not loaded for Android projects using Gradle version catalogs (libs.versions.toml)Forse già presa @aalej l’ha presa 21 giorni fa. Apertaapi: mcp reproducible type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
firebase/firebase-tools#11351 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
CLI HTTP client ignores NO_PROXY, so emulators can’t reach each other behind a proxyForse già presa @joehan l’ha presa 35 giorni fa. Apertaemulator-suite type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
firebase/firebase-tools#11249 · 1 commento · 2 reazioni · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
functions:secrets:set and :prune never destroy anything: pruneSecrets filters firebase-managed=true, but labels() writes firebase-managed=functionsForse già presa @IzaakGough l’ha presa 69 giorni fa. Apertaapi: functions reproducible type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
firebase/firebase-tools#11066 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di firebase/firebase-tools
Issue simili
-
bot:ai-assisted component:platform-js status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
midnightntwrk/platform-js#69 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Picolab/pico-engine#668 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
ai-driven-qa bug claude Cosmetic
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
needs verification
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 13 giorni