Skip to content

Commit 68be9c5

Browse files
authored
Fix functions:secrets:set - stop erroring in non-interactive flows without force option (#7467)
* Adding error for non-interactive flows without force option * add changelog entry * update changelog * fixing error message * add a guard around the prompt to stop erroring if we are in non-interactive mode * update changelog msg
1 parent 3d05283 commit 68be9c5

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- Fixed an issue where `--force` was not respected during `firebase deploy --only storage`. (#7499)
22
- Added support for Customer-managed encryption keys (CMEK) on Firestore databases. (#7479)
33
- Improved default values for 'init dataconnect:sdk'.
4+
- Fix functions:secrets:set - stop erroring in non-interactive flows without force option (#7467)

src/commands/functions-secrets-set.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,20 @@ export const command = new Command("functions:secrets:set <KEY>")
8282
);
8383

8484
if (!options.force) {
85-
const confirm = await promptOnce(
86-
{
87-
name: "redeploy",
88-
type: "confirm",
89-
default: true,
90-
message: `Do you want to re-deploy the functions and destroy the stale version of secret ${secret.name}?`,
91-
},
92-
options,
93-
);
85+
let confirm = false;
86+
// The promptOnce function will throw an error if non interactive mode is set,
87+
// so we can safely skip the prompt and end early below in the !confirm check.
88+
if (!options.nonInteractive) {
89+
confirm = await promptOnce(
90+
{
91+
name: "redeploy",
92+
type: "confirm",
93+
default: true,
94+
message: `Do you want to re-deploy the functions and destroy the stale version of secret ${secret.name}?`,
95+
},
96+
options,
97+
);
98+
}
9499
if (!confirm) {
95100
logBullet(
96101
"Please deploy your functions for the change to take effect by running:\n\t" +

0 commit comments

Comments
 (0)