iTranslated by AI
Deploying a specific function from a specific codebase in Firebase Functions
Conclusion
# firebase deplop --only functions:[codebase]:[functionName]
% firebase deplop --only functions:py:hello_world
The Problem
When deploying Firebase Functions, there are cases where you only want to deploy a specific function.
In such cases, as described in the documentation, you can deploy using the following command.
# firebase deplop --only functions:[functionName]
% firebase deplop --only functions:helloWorld
However, the function I wanted to deploy this time was a specific function that belonged to a different codebase. In that case, the CLI cannot find the function using the command above.
When the codebase is not default
The function configuration object in Firebase has a property called codebase, which allows you to manage multiple source packages within a single repository.
"functions": [
{
"source": "teamA",
"codebase": "team-a"
},
{
"source": "teamB",
"codebase": "team-b"
},
]
In this case, you can deploy a specific codebase by specifying it as follows:
$ firebase deploy --only functions:team-b
i deploying functions
i functions: preparing codebase team-b for deployment
i functions: updating Node.js 16 function team-b:helloBTeam(us-central1)...
...
By separating codebases, you can manage JavaScript functions and Python functions simultaneously.
This much is described in the documentation, but the method for deploying a specific function within a specific codebase was not mentioned. (As far as I searched, I couldn't find where it was described.)
After trying various things, as I mentioned at the beginning, I was able to deploy a specific function of a specific codebase with the following command.
# firebase deplop --only functions:[codebase]:[functionName]
% firebase deplop --only functions:py:hello_world
Discussion