Functions params: a param with a default still fails deploy in --non-interactive mode
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nodejs, typescript
- Lĩnh vực
- cli
Hướng nghiên cứu
Bắt đầu trong src/deploy/functions/params.ts quanh resolveParams (dòng 427-454), nơi các tham số thiếu trong tệp dotenv được đưa vào danh sách prompt và chế độ không tương tác sẽ ném lỗi. Đọc phần xử lý giá trị mặc định của ParamBase ở phía trên, sau đó kiểm tra độ bao phủ hiện có trong src/deploy/functions/params.spec.ts. Hoàn thành nghĩa là một deploy không tương tác phân giải các giá trị mặc định CEL dạng literal hoặc đã có thể phân giải, và chỉ báo lỗi cho các tham số vẫn chưa có giá trị, kèm một test thực thi trường hợp mặc định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[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.
- Ngôn ngữ chính
- TypeScript
- Star
- 4.5k
- Fork
- 1.3k
- Merge trung bình
- 3 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 99
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của firebase/firebase-tools
-
Raising memory on an existing 2nd gen function keeps the old CPU, so deploys above 4GiB failCó thể đã có người làm @anjalimishra-0007 đã nhận 2 ngày trước. Đang mởapi: functions reproducible type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
firebase/firebase-tools#11492 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[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)Có thể đã có người làm @abhiramshaji-cyber đã nhận 20 ngày trước. Đang mởreproducible type: bug VSCode Extension
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
firebase/firebase-tools#11363 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[MCP] Crashlytics tools not loaded for Android projects using Gradle version catalogs (libs.versions.toml)Có thể đã có người làm @aalej đã nhận 21 ngày trước. Đang mởapi: mcp reproducible type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
firebase/firebase-tools#11351 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
CLI HTTP client ignores NO_PROXY, so emulators can’t reach each other behind a proxyCó thể đã có người làm @joehan đã nhận 35 ngày trước. Đang mởemulator-suite type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
firebase/firebase-tools#11249 · 1 bình luận · 2 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
functions:secrets:set and :prune never destroy anything: pruneSecrets filters firebase-managed=true, but labels() writes firebase-managed=functionsCó thể đã có người làm @IzaakGough đã nhận 69 ngày trước. Đang mởapi: functions reproducible type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
firebase/firebase-tools#11066 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của firebase/firebase-tools
Issue tương tự
-
bot:ai-assisted component:platform-js status:untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
midnightntwrk/platform-js#69 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Picolab/pico-engine#668 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-driven-qa bug claude Cosmetic
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs verification
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 13 ngày