Quan Vuong
Quan Vuong

Reputation: 1989

firebase deploy --only functions overrides existing functions

Running firebase deploy --only functions deletes the existing functions before creating new ones. Is it possible to modify this behavior to create if not exist, update if exists, no actions if functions not being deployed?

Upvotes: 87

Views: 90700

Answers (4)

fazal ur Rehman
fazal ur Rehman

Reputation: 404

For me issue was I did not put my actual code inside functions folder I was uploading from root folder,,,placing actual code inside functions code solved my issue!!

Upvotes: 0

Frank van Puffelen
Frank van Puffelen

Reputation: 598668

Since version 3.8 of the Firebase tools CLI this is possible. See Pablo's answer or the release notes.

Prior to 3.8, running firebase deploy will deploy all functions in the project. There is no option to deploy just new or modified functions.

It does sound like a useful addition though, so you might want to file a feature request.

Upvotes: 16

Pablo Albaladejo
Pablo Albaladejo

Reputation: 3249

You can use firebase partial deploys

$ firebase deploy --only functions:makeUppercase

Will only deploy makeUppercase function.

Note: To deploy more than one function at once (but not all) use:

$ firebase deploy --only functions:function1,functions:function2

Upvotes: 237

Jonathan
Jonathan

Reputation: 4689

Make sure you are editing the functions in your "functions/src" directory and not the functions in your 'lib' directory. I made this mistake and watched them get replaced...

Upvotes: 2

Related Questions