Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All secrets managed by firebase are pruned when I set a new version of one #4459

Closed
fgruchala opened this issue Apr 20, 2022 · 10 comments · Fixed by #4519
Closed

All secrets managed by firebase are pruned when I set a new version of one #4459

fgruchala opened this issue Apr 20, 2022 · 10 comments · Fixed by #4519
Assignees

Comments

@fgruchala
Copy link

[REQUIRED] Environment info

firebase-tools: 10.7.0

Platform: Ubuntu & macOS

[REQUIRED] Test case

firebase functions:secrets:set SECRET_NAME

This SECRET_NAME has to be labeled firebase-managed: true and used in a Cloud Function.

[REQUIRED] Steps to reproduce

Capture d’écran 2022-04-20 à 16 22 02

[REQUIRED] Expected behavior

Just the SECRET_NAME has to be set and prune old version.
Not all ANOTHER_SECRET_NAME flagged firebase-managed: true

[REQUIRED] Actual behavior

It seems to prune all secrets flagged firebase-managed: true
Capture d’écran 2022-04-20 à 16 22 02

@dimadeveatii
Copy link

I can confirm this issue, it happened to me as well.

When updating a secret, it asks you to redeploy all functions that uses it. Once you deploy them, it looks like it just prunes all other secrets that are used by other functions (without any confirmation).

This is quite critical, as in my case I ended up having a lot of secrets being destroyed.

taeold added a commit that referenced this issue May 4, 2022
These pruning are surprising users (see #4459). I'm going to work on improving the UX of the pruning. Until then, users can still prune unused secrets via functions:secrets:prune command.
@taeold
Copy link
Contributor

taeold commented May 4, 2022

Thanks for the feedback folks. It looks like our attempt to clean things up in order to make secrets less expensive to use is causing more trouble than I've anticiapted. I'm going back to the drawing boards to improve the UX of the pruning and will rollback automatic secret pruning after deploy.

You'll likely want to use firebase functions:secrets:prune from time to time to keep your # of secrets under the free quota!

taeold added a commit that referenced this issue May 4, 2022
These pruning are surprising users (see #4459). I'm going to work on improving the UX of the pruning.

Until then, users can still prune unused secrets via `functions:secrets:prune` command.
@dimadeveatii
Copy link

dimadeveatii commented May 9, 2022

@taeold using 10.8.0 and running firebase deploy --only functions still results in secrets being pruned without any prompt/confirmation message. Is it possible to completely disable auto pruning of secrets?

@dimadeveatii
Copy link

@taeold using 10.8.0 and running firebase deploy --only functions still results in secrets being pruned without any prompt/confirmation message. Is it possible to complete disable auto pruning of secrets?

In our case this is what happened:

  • We configured all production secrets (~15 secrets)
  • We then deployed only one function using firebase deploy --only functions:my-func that uses one of the secrets
  • Result: all other secrets are pruned upon function deployment

And there is no workaround, it means we have to deploy all functions all-together if we want secrets not to be pruned.

@cayleyh
Copy link

cayleyh commented May 10, 2022

We had this happen when a new deploy went out via CI. We didn't set or change any secrets or versions, but the prune command removed everything anyway (!).

We're now forcing 10.7 to be used until this can get addressed correctly.

@colerogers colerogers self-assigned this May 12, 2022
@colerogers
Copy link
Contributor

@dimadeveatii @cayleyh

Hey folks, I'm not able to re-produce the pruning behavior that you're experiencing. Here's what I did:

  • Updated to the latest firebase-tools and firebase-functions
  • Create 3 new secrets using the CLI command (firebase functions:secrets:set SECRET_NAME)
  • Create 3 functions that each use one of the secrets
  • Run firebase deploy --only functions:$FUNC to deploy only one of the functions

The secrets that are not is use are not being pruned. Did I miss something in the above steps? Thanks

@mthomas-io
Copy link

@colerogers which version did you use? I think this just got fixed yesterday with the 10.9.2 release https://github.com/firebase/firebase-tools/releases/tag/v10.9.2 which fixed #4540 and I think is a duplicate of this issue.

@emilioiz
Copy link

@colerogers I agree with @mthomas-io findings. I just spent hours trying to figure out what was going on to my function secrets and reviewing the docs over and over until I landed here. Nothing was working until I updated firebase-tools again. Then it all started working as expected.

@colerogers
Copy link
Contributor

Yep you're correct, I was using the latest for both (10.9.2 for firebase-tools and 3.21.1 for firebase-functions). Apologies for the headache everyone! If the latest release works for everyone here, I'm going to close out this issue.

@cayleyh
Copy link

cayleyh commented May 16, 2022

@colerogers not sure if it's possible, but can the broken versions be pulled from NPM? This caused pretty serious live ops issues for us and I'd hate for someone else to have it happen because the happen to get one of these versions somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants