How to configure and require HTTPS in cloud functions during firebase deploy? - firebase

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.

Related

Firebase Deploy only hosting NO functions

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!

Initializing Firebase Functions Emulator For Correct Project

I am developing a project with Firebase backend, utilising Firebase Functions. I actually two projects: myProject and myProject-test (used for deployment testing).
When submitting API calls, my (React) front-end is configured to call the myProject-test URL when running in local development, and only direct the calls to myProject when deployed on PROD.
The problem I am facing is that when I start my cloud functions emulator using firebase emulators:start, my cloud functions get started on the localhost:5001/myProject/... url instead of localhost:5001/myProject-test/..., and hence the API calls from my local development instance never arrive.
How can I control for which project the emulators start?
This is what the firebase use command is for. Read the documentation on managing aliases. You can run the command firebase use PROJECT_ID|ALIAS to set the current project or alias that is currently use use for the emulator or other commands.

Deploy to Firebase without cloud functions?

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

Firebase - Deploy Your Site - Deletes 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

How to deploy Firebase Hosting and Cloud Functions for Firebase with different code base?

I'm using Google Firebase: Database (to store my data) and Hosting (to run my web application). The web application is build with Webpack/Vue.
Now I would like to use some Database Functions as a backend API for some server handling.
Is this possible? If so, how can I deploy two separate projects to Firebase Hosting and Functions?
I dont know if this is what you're looking for but you can either
firebase deploy --only hosting or database or functions
or install firebase in different

Resources