0

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

2 Answers2

1

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.

0

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
Ralemos
  • 5,571
  • 2
  • 9
  • 18
  • Thank you for your reply @Rafael! I should have specified that I have already tried that. However it also skips the deployment of both functions if I leave out the second `functions:` part. – SanderThunder Mar 24 '21 at 15:36
  • Well, in that case you are doing everything correctly. I would say that you should probably reach out to [Firebase Support](https://firebase.google.com/support), as this does not appear to be the expected behavior of Firebase Cli – Ralemos Mar 24 '21 at 15:43
  • Thanks again! I will try that in the weekend. I also updated my question with how I implemented the cloud functions themselves. Maybe you can see if the way the functions are 'grouped' is wrong, as they work fine when deploying separately. – SanderThunder Mar 25 '21 at 07:29
  • they appear to be declared correctly, are those 2 the only functions in the group? If so you could deploy the whole group with `firebase deploy --only functions:authentication`. – Ralemos Mar 25 '21 at 15:21
  • 1
    The group contains many more functions and I only want to deploy 2 or 3 that I'm working on at a time. I'm going to see if this might be a bug with the Firebase support. Thanks for taking your time to look at my question. – SanderThunder Mar 25 '21 at 17:05