Initializing Firebase Functions Emulator For Correct Project - firebase

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.

Related

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

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.

How to deploy existing application to the Divio Cloud

I have django-cms application and I want to deploy it to the Divio cloud and really can't understand from the docs how to do it. I understand how to start new application using divio cli but not how to deploy existing.
The specifics of how to deploy an existing application to Divio Cloud vary widely based on the application structure itself. Basically Divio Cloud allows to deploy any web application which can be packaged in a Docker image.
There is some documentation about the process of migrating an existing Django application to Divio Cloud here: http://divio-cloud-developer-handbook.readthedocs.io/en/latest/how-to/migrate-existing-project.html

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

How to deploy google firebase functions using cmd?

I have a problem with a web hosting project. I created a new proyect in google firebase, and I executed the following commands:
C:\myproject>firebase init functions
C:\myproject>firebase deploy --only functions
But the site says this:
Site Not Found
Why am I seeing this?
There are a few potential reasons:
You haven't deployed an app yet.
You may have deployed an empty directory.
This is a custom domain, but we haven't finished setting it up yet.
How can I deploy my first app?
Refer to our hosting documentation to get started.
What could I do for show, at least, some text when an user go to my project url?
The way you now invoke the Firebase CLI, it will only deploy the Cloud Functions in your project. It will not deploy the web site. In fact, the way you've run it, it probably didn't even create a web site to deploy.
Initialize the project with:
firebase init
And answer the questions this shows.
If you want to deploy the web site, use:
firebase deploy --only hosting
More likely you should simply deploy everything to prevent running into this problem:
firebase deploy

How do I deploy the polymerfire demo to firebase?

I want to try the demo for polymerfire in firebase. To get it run locally I followed these steps. But what exact steps do I need to do to get it to run in firebase?
I figured firebase init and firebase deploy should be run but the browser only displays errors in the console. Must the polymer project be build in a certain way and what should the firebase "public" folder be?
All files from public folder will be deployed to your Firebase static web hosting, so you can access them though your Firebase hosting address like https://projectname-5gek53.firebaseapp.com/. This allows you to upload your web app.
You build your polymer app (I guess you need to run polymer build). You drag all files generated as production build to your public folder. Next, you run firebase deploy and after deployment process your app will be accessible from your hosting address as I mentioned above.
Edit: Polymerfire demo is actually not that simple to export, but I found a really nice tutorial step-by-step from Google Codelabs here is a link Build a Progressive Web App with Firebase, Polymerfire and Polymer Components
I just installed a new version of the polymer cli and Firebase cli. When I do a Polymer build, no build/bundled or build/unbundled is created.
I do get a build/default, which I can run with a firebase serve and a firebase deploy. So something has changed recently. just fyi

Resources