Using production or dev firebase app based on build mode in flutter web - firebase

While developing a flutter web app, I was using the dev firebase project. Now, when the development is finished it is required to use the production firebase project for production. How can this be done other then simply swapping the firebase dev configuration from index.html with the prod firebase config before building the app.
I tried this tutorial Dynamic HTML elements but I couldn't adapt it to my solution.
I thought that the configuration could be added as a child but an error was thrown:
Expected a value of type 'Element', but got one of type 'FirebaseOptions'

Related

Debug Firebase hosted Flutter Web app locally in Android Studio

I have a Flutter web application that is hosted in Firebase.
I'm using the setup described here to load the correct firebase configurations depending on the Firebase environment the application is running in.
My trouble is now I want to be able to debug this locally in my IDE.
I can run the application locally using firebase serve, which starts the webapp (e.g. on localhost:5000) and serves the correct firebase config based on the environment/alias I'm using, that's all nice and good.
My question is whether it is now possible to debug that running application in Android Studio? I know there are ways to do this in Visual Studio code, but I'd rather find a setup that works with AS if possible.
I could also debug the application by clicking the debug button in Android studio, and that will try to launch the application, however it will fail to start since it wont be served the firebase config file correctly (since this is firebase serve does for us).
Is there a way to combine the debugging capabilities of Android Studio with the firebase serve command to give a working application that's debuggable in my IDE?
Thanks in advance,
Gary

How can I retrieve firebase hosting deploy ID or message inside my webapp?

For logging purposes I´d like to print to console or even display the current deploy ID (or message) of my firebase web app that is being accessed by the browser.
Firebase Hosting recently released a new REST API. You can use sites.releases.list to see what version is currently deployed.
Old answer:
Firebase deploy IDs don't appear to be available anywhere via programmatic access. The CLI doesn't support listing current or previous deploys.
My recommendation would be to go in the other direction. Have your source code in a vcs like git. When you build and deploy a new version set the vcs hash or version in the deployed code and as the message for firebase deploy. You can then log the log the source version in your code and you can manually associate that back to a release in the Firebase UI.

Vue app - Firebase deploy database issues

I successfully deployed my Vue app using Firebase hosting except for one small thing - the database that I was running from localhost isn't appearing / being referenced when I navigate to the hosting URL (https://.firebaseapp.com.
Instead, any changes I make in attempt to recreate the data on the hosted site only effects my instance running on localhost!
Basically:
Why am I not seeing any db data once i deploy using the standard firebase commands firebase init and firebase deploy?
When I deploy how can I use the same database from localhost but have it running as a copy so that the deployed database and localhost database are kept separate?
I answered the first part via changing how I was deploying. Screenshot is attached.
I answered the second part through this post

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