SanderThunder
SanderThunder

Reputation: 73

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

Upvotes: 0

Views: 671

Answers (2)

SanderThunder
SanderThunder

Reputation: 73

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.

Upvotes: 1

Rafael Lemos
Rafael Lemos

Reputation: 5829

Its not working because you are adding the functions: part of the command before every function to be deployed.

As you can see in the documentation, to specify each function within a group you just need to declare it in the format deploy --only functions:groupA.function1,groupB.function4, so applying to your case, if you use the following command it should work:

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

Upvotes: 0

Related Questions