Search code examples
firebasegoogle-cloud-functionsfirebase-cli

Firebase partial deploy multiple grouped functions


I'm trying to deploy multiple grouped cloud functions at once with the following command

firebase deploy --only functions:groupName.functionName,functions:groupName.anotherFunctionName

However it is simply skipping the deployment of these functions. If I deploy them individually like so firebase deploy --only functions:groupName.functionName and firebase deploy --only functions:groupName.anotherFunctionName one after the other they are being deployed. I would like to be able to do it in a single command.

Am I missing something or is this functionality simply not built in yet?

EDIT

I also tried the following command with the same result:

firebase deploy --only functions:groupName.functionName,groupName.anotherFunctionName

EDIT

Maybe there is something different about the way our functions are declared in the functions/index.ts:

exports.authentication = require('./authentication')

and in functions/authentication.ts:


exports.createCustomToken = functions
    .region('europe-west1')
    .https
    .onCall(async (data: any, context: any) => {/*...*/})

exports.anotherFunction= functions
    .region('europe-west1')
    .https
    .onCall(async (data: any, context: any) => {/*...*/})

which would lead to the command

firebase deploy --only functions:authentication.createCustomToken,authentication.anotherFunction

Solution

  • The correct way of deploying multiple single cloud functions that are part of a group is like this:

    firebase deploy --only functions:groupName.functionName,functions:groupName.anotherFunctionName
    

    This can now be found in the official documentation, as Rafael Lemos pointed out in his post.

    If it doesn't work for you like this, you might need to setup your node environment and the Firebase CLI Tools again. This is a breeze with the Node Version Manager NVM. Installing the latest LTS version and nvm use --lts and the following npm i -g firebase-tools should do the trick.