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

Runtime environment variables are deleted during function deployment using tools 9.4.0 or greater #3226

Closed
pawlowskim opened this issue Mar 23, 2021 · 6 comments
Assignees

Comments

@pawlowskim
Copy link

[REQUIRED] Environment info

firebase-tools: 9.4.0 or greater

Platform: macOS Catalina (v 10.15.7), node v10.21.0

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

  1. Create and deploy any cloud function
  2. Edit created cloud function and add runtime environment variable CUSTOM_VARIABLE:some_value (from GCP console)
  3. Re-deploy cloud function from 1.

[REQUIRED] Expected behavior

CUSTOM_VARIABLE:some_value - should persists across deployments.

[REQUIRED] Actual behavior

Only FIREBASE_CONFIG runtime variable is available in the function.

Few things I have spotted:

  • it doesn't matter if I update function from node 8 to node 10 during update
  • deployment works using [email protected]
  • deployment tested and not working on version 9.4.0, 9.5.0, 9.6.1 (9.6.0 not tested)
  • no breaking changes in release notes (yea, production broken because of that 😢 )
  • v 9.3.0 src/deploy/functions/prepare.js had code line like this var runtimeFromConfig = options.config.get("functions.runtime"); which is missing in 9.4.0+, and only default parameters are re-written to environmentVariables of a function. This might help you track down the problem. v9.3.0...firebase:v9.4.0#diff-ef26a08c6cb27fae2c011ca0638635007349132a1f8e3957a0ee1306d2cc3ce5R58
@i14h
Copy link
Member

i14h commented Mar 29, 2021

@pawlowskim thanks for reporting this. @joehan can you take a look please?

@taeold taeold self-assigned this Apr 6, 2021
taeold added a commit that referenced this issue Apr 8, 2021
)

Today, we unexpectedly delete environment variables on existing Cloud Functions when updating functions via `firebase deploy --only functions` command #3226. This regression was introduced in #3132.

### Scenarios Tested
1. Manually setup an environment variable using Google Cloud Console on a firebase function.
2. Run `firebase deploy --only functions` to update the existing function.
3. Notice that existing environment variable isn't wiped out as a result of the new deploy.
@taeold
Copy link
Contributor

taeold commented Apr 8, 2021

The fix should be available on the next release of the CLI (ETA: ~week?). I'll close the issue once the release including #3266 is cut.

@pawlowskim
Copy link
Author

Great, thanks for the fix and update :) will test it out for sure.

@taeold
Copy link
Contributor

taeold commented Apr 13, 2021

Fixed released in 9.10.0. Please upgrade your CLI to receive the patch and deploy away!

@taeold taeold closed this as completed Apr 13, 2021
@pawlowskim
Copy link
Author

Would be good to update release notes https://github.com/firebase/firebase-tools/releases
Will test in next 2 weeks - thanks for the fix.

@taeold
Copy link
Contributor

taeold commented Apr 16, 2021

Ah missed my opportunity to update the changelog :( sorry.

devpeerapong pushed a commit to devpeerapong/firebase-tools that referenced this issue Dec 14, 2021
…rebase#3266)

Today, we unexpectedly delete environment variables on existing Cloud Functions when updating functions via `firebase deploy --only functions` command firebase#3226. This regression was introduced in firebase#3132.

### Scenarios Tested
1. Manually setup an environment variable using Google Cloud Console on a firebase function.
2. Run `firebase deploy --only functions` to update the existing function.
3. Notice that existing environment variable isn't wiped out as a result of the new deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants