I'd like to be able to deploy an individual Cloud Function for Firebase so I don't have to deploy my entire project every time.
There isn't an option through the CLI, but if there's a rest API or some other interface that Google or Firebase exposes to make this easier, that would be great.
The CLI provides the capability to deploy a single function:
firebase deploy --only functions:myFunction
or list of functions:
firebase deploy --only functions:myFuncA,functions:myFuncB,functions:myFuncC
For more details:
firebase deploy --help
Related
I have cloud functions in GCP that I deploy using the firebase deploy command via GitHub workflows. However, I noticed that the HTTP triggered cloud functions does not require HTTPS upon deployment.
Does anyone have any idea if there is a flag similar to --security-level=secure-always that can be appended to firebase deploy command?
While it can be configured using gcloud functions deploy <function_name> --security-level=secure-always command, I observed that the firebase deploy command deploys functions faster than gcloud, so as much as possible, I would like to stick with using firebase deploy.
In the project I'm currently working on, I have set up Firebase hosting and cloud functions.
I thought that I could only deploy functions like this: firebase deploy --only hosting --token %FIREBASE_TOKEN% However, when I run the command it also deploys the cloud functions. Am I doing something wrong? How can I deploy ONLY the changes I've made in hosting without re-deploying the cloud functions.
Thank you!
When I try to deploy my Firebase app, I get the following error:
Error: Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan.
I no longer want to use Cloud Functions on my app, and I have no references to Cloud Functions in my code. How can I now deploy my app without Cloud Functions?
if you are just deploying hosting you can say so
firebase deploy --only hosting
this will not deploy functions
I have a firebase project setup and I want to use that same project for both an iOS app and to host a website.
I built a basic iOS app.
On my desktop I have a folder:
myiosproject
- iOS
- firebase
- functions
- index.js
I followed the steps to setup cloud functions which according to the docs are to npm install firebase tools, firebase init and then firebase deploy. I've deployed my code to cloud functions and that works fine.
I've also built a basic website and would like to deploy that to firebase hosting. On my desktop I have a folder:
myWebsite
- images
- index.html
According to the hosting docs the process to set up and deploy is the same as for cloud functions: npm install, firebase init, firebase deploy.
So my question is how does firebase "know" if I am running firebase deploy from my website folder in which case the code should go to hosting or whether I am deploying from my firebase functions folder in which case the code should go to firebase cloud functions?
If you use the Firebase CLI to create your project (https://firebase.google.com/docs/hosting/quickstart) your project will organize your code by default, separating the files to be used for hosting under a "public" directory and the source code for Cloud Functions under a "functions" directory.
Then you can choose to deploy only the hosting
firebase deploy --only hosting
or only the functions:
firebase deploy --only functions
Have a look at the detailed CLI documentation: https://firebase.google.com/docs/cli/
According to the docs:
firebase-deploy
it deploys the following:
New releases of your Firebase Hosting sites
New or existing Cloud Functions
Rules for Firebase Realtime Database
Rules for Cloud Storage
Rules for Cloud Firestore
Indexes for Cloud Firestore
if you only want to deploy specific features, you can do the following:
firebase deploy --only hosting <-- for hosting
firebase deploy --only functions <-- for cloud functions
Question
How can I deploy my Firebase site without erasing Cloud Functions.
Maybe, include both site and cloud-functions in one deploy? What does that look like?
Maybe, deploy the site without erasing cloud-functions? I don't find a firebase deploy --only site or similar
Context
I have a Firebase project that uses Cloud Functions. The code is in two folders:
-site-code
-cloud_function-code
When I want to deploy the project, I use firebase CLI tools, in two steps:
Step 1
from -site-code I run:
firebase deploy
Step 2
then from cloud_functions-code I run:
firebase deploy --only functions
Issue
When I run firebase deploy from -site-code, my Firebase Cloud Functions are deleted, so I must follow up with firebase deploy --only functions from -cloud_functions-code.
I did not find an --only directive for deploying just the site code from -site-code
To only deploy your web site, use
firebase deploy --only hosting
The Firebase CLI provides a way to deploy single functions as shown in its documentation:
firebase deploy --only functions:name_of_function