0
0
Firebasecloud~10 mins

Function deployment in Firebase - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Function deployment
Write function code
Initialize Firebase CLI
Run deployment command
Upload code to cloud
Cloud builds and deploys
Function available to use
This flow shows how you write your function, use Firebase CLI to deploy it, and then it becomes available in the cloud.
Execution Sample
Firebase
firebase deploy --only functions
// Deploys your local functions to Firebase cloud
This command uploads your function code and deploys it to Firebase cloud.
Process Table
StepActionEvaluationResult
1Run 'firebase deploy --only functions'CLI checks project and functions folderReady to deploy functions
2Upload function code to Firebase cloudCode files sent to cloud build systemCode received by cloud
3Cloud builds functionBuild succeeds without errorsFunction package created
4Cloud deploys functionFunction deployed to cloud endpointFunction available to trigger
5Verify deploymentCall function URL or triggerFunction runs and returns expected result
6ExitDeployment completeFunction ready for use
💡 Deployment finishes when function is successfully uploaded, built, and available in the cloud.
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
function_codelocal filesuploaded to cloudbuilt into packagedeployed to cloudavailable for use
deployment_statusnot starteduploadingbuildingdeployingcomplete
Key Moments - 3 Insights
Why does deployment fail if the build step has errors?
Because the cloud cannot create a valid function package, deployment stops at step 3 as shown in the execution_table.
What happens if you run deployment without initializing Firebase CLI?
The CLI cannot find project info, so step 1 fails and deployment does not start, preventing upload and build.
How do you know the function is ready to use?
Step 5 shows verification by calling the function; if it runs and returns expected results, deployment succeeded.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the deployment_status after step 3?
Abuilding
Bdeploying
Cuploading
Dcomplete
💡 Hint
Check the variable_tracker row for deployment_status at After Step 3.
At which step does the function become available to trigger?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
See execution_table row for Step 4 where function is deployed to cloud endpoint.
If the build fails, what will be the last successful step in deployment?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Refer to key_moments explanation about build errors stopping deployment at step 3.
Concept Snapshot
Function Deployment in Firebase:
- Write your function code locally.
- Use 'firebase deploy --only functions' to deploy.
- CLI uploads code to cloud build system.
- Cloud builds and packages the function.
- Function is deployed and ready to use.
- Verify by triggering the function.
Full Transcript
Function deployment in Firebase starts by writing your function code on your computer. Then you use the Firebase CLI tool to deploy only the functions by running 'firebase deploy --only functions'. The CLI checks your project and uploads your code to the cloud. The cloud system builds your function code into a package. If the build succeeds, the function is deployed to a cloud endpoint and becomes available. You can verify deployment by calling the function and checking it runs correctly. Deployment stops if there are build errors or if the CLI is not initialized properly.