KeepOnLearning
KeepOnLearning

Reputation: 45

Why are Cloud Function Runtime Environment Variables being deleted on deploy?

I recently (2 days ago) upgraded the node runtime engine on our Cloud Functions instance from Node 10 to 12. (Not sure that is a factor, but it is a recent change.)

Since the upgrade I have been using the Cloud Functions project without trouble. Today is the first time I have done a deploy SINCE the deployment to change the node engine. After I did the deploy, ALL of the Runtime Environment Variables were deleted except one labeled FIREBASE_CONFIG.

As a test, I added another test environment variable via the Cloud Functions console UI. I refreshed the page to ensure the variable was there. Then, I ran another deploy, using this command:

firebase use {project_name} && firebase deploy --only functions:{function_name}

After the deploy completed, I refreshed the environment variables page and found that the test variable I had created was now missing.

I'm quite stumped. Any ideas? Thank you!

Upvotes: 2

Views: 955

Answers (1)

pessolato
pessolato

Reputation: 1572

It is true that the Firebase CLI manages enviroment configuration and does not allow us to set the ENV variables of the runtime during deployment. This has been explained on other post as well, like this one.

I guess you are aware of the difference between the Cloud Functions Runtime Variables and the Firebase Environment configuration, so I will just leave it here as a friendly reminder.

Regarding the actual issue (New deployments erasing previously set "Cloud Functions Runtime Variables"), I believe this must have been something they fixed already, because I have tested with version 9.10.2 of the firebase CLI, and I could not replicate the issue on my end.

I recommend checking the CLI version that you have (firebase --version) and, if you still experience the same issue, provide us with the steps you took.

Upvotes: 1

Related Questions