Deploy Only Single Non-exported Function in Firebase Cloud Functions

时间:2017-12-18 06:55:04

标签: node.js firebase command-line google-cloud-functions

I have created the following function in my the file of my firebase cloud functions:

function whatsMyName(name) {
  return "your name is " + name
} 

When I run the following in the command line, then the function is deployed:

firebase deploy --only functions

But, this deploys all of my functions. I would like to only deploy the whatsMyName function. Typically, if I have a function that is exported, like so:

exports.someExportedFunction = functions.https.onRequest((req, res) => {
   // do some stuff
}

Then I can run the following to deploy the exported function:

firebase deploy --only functions:someExportedFunction

However, when I run the following, the non-exported function is not deployed:

firebase deploy --only functions:whatsMyName

Does anyone understand why this doesn't individually deploy my non-exported function, whatsMyName, and how to deploy a non-exported function for Firebase Cloud Functions?

1 个答案:

答案 0 :(得分:1)

The CLI can only individually deploy exported function triggers. It can not specifically deploy any arbitrary JavaScript named function.

In other words, what you're trying to do is not currently possible.