How to deploy some functions to Cloud Functions for Firebase without affecting some other functions?

Randy Sugianto 'Yuku' picture Randy Sugianto 'Yuku' · Apr 13, 2017 · Viewed 28k times · Source

When I run

firebase deploy --only functions

it reads the index.js file and updates all functions exported from that file. If on the previous deploy there was a function named a, and in the current deploy there is no such function, a will be deleted.

In other words, the effect is the same as if all existing functions were deleted and then the all functions from the current index.js file were added.

Is it possible to add/update/delete individual functions?

Answer

Randy Sugianto 'Yuku' picture Randy Sugianto 'Yuku' · May 16, 2017

Firebase CLI tools 3.8.0 has added the ability to deploy specific functions.

firebase deploy --only functions:func1,functions:func2

--only <targets>     
only deploy to specified, comma-separated targets (e.g. "hosting,storage"). For functions, 
can specify filters with colons to scope function deploys to only those functions (e.g. "--only functions:func1,functions:func2"). 
When filtering based on export groups (the exported module object keys), use dots to specify group names 
(e.g. "--only functions:group1.subgroup1,functions:group2)"