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
?
Asked
Active
Viewed 7.1k times
82

Frank van Puffelen
- 565,676
- 79
- 828
- 807

Quan Vuong
- 1,919
- 3
- 14
- 24
3 Answers
220
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

starball
- 20,030
- 7
- 43
- 238

Pablo Albaladejo
- 2,950
- 1
- 17
- 21
-
34It's also possible to deploy multiple functions in a partial deploy: `firebase deploy --only functions:function1,functions:function2` – Thorbjørn Kappel Hansen Sep 07 '17 at 10:06
-
I believe the best solution would be using groups, also seen in the documentation link. – Simon Moshenko Aug 20 '18 at 05:30
-
But how should you actually NAME your firebase functions? What does it Actually look like? – Mars2024 Apr 29 '22 at 20:07
16
firebaser here
Running firebase deploy
will deploy all functions in the project. There is currently 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.
Update: since version 3.8 of the Firebase tools CLI this is possible. See Pablo's answer or the release notes.

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
-
-
1I could use some help with this! I would like to deploy multiple functions as well. I have set up my project structure exactly like https://github.com/firebase/functions-samples has. In fact, I used it as a base, stripped all but two functions, modified, and want to deploy. I have tried firebase deploy, firebase deploy --only ..., and comma separated attempts. – Quinn Turner Mar 23 '17 at 20:59
-
If I run "firebase deploy" from root I get that it couldn't locate firebase.json. My guess is I have to restructure the applications, but I haven't had any luck after trying a few alternatives. – Quinn Turner Mar 23 '17 at 21:04
-
@QuinnTurner Try running `firebase init`, which will add all necessary files. – Scott Apr 13 '17 at 23:53
-
@QuinnTurner please don't post new questions in a comment. If you have a new problem, post a new question. Be sure to include the [minimal code that reproduces the problem](http://stackoverflow.com/help/mcve) in that question (and read the link, it's quite useful). – Frank van Puffelen Apr 14 '17 at 06:32
1
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...

Jonathan
- 3,893
- 5
- 46
- 77