Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)"

The following way worked for me to deploy a particular function without affecting my other functions, where "specificFunctionName" is the function I wanted to deploy

firebase deploy --only functions:specificFunctionName

firebaser here

There is currently no way to deploy a single function with the Firebase CLI. Running `firebase deploy` will deploy all functions.

We've recently discussed deploying subsets of the functions, but it's not available at the moment - nor can we give a ballpark of if/when it might be.

Update Since Firebase CLI release the ability to deploy single functions is available. See yuku's answer.


firebase deploy --only "functions:<fileName>.<functionName>"

example folder structure:

functions 
  node_modules
  index.js
  smsNotification.js
  ...

You can redeploy just a function in a file with

firebase deploy --only "functions:smsNotification.sendChatNotif"

You can redploy all functions in a file with

firebase deploy --only "functions:smsNotification"