How to update a file that I deployed to Firebase Hosting? - firebase

On deploying my app to Firebase, I am getting this message:
You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!
I learnt from a previous post that I need to replace the default index.html with my custom index.html. How do I do that using the Firebase Console?

You cannot change hosted files in the Firebase Console.
Instead, you should change the index.html on your local copy where you initially ran the firebase deploy command. Once you're done with the changes, run firebase deploy again to push the updated version of your website to Firebase Hosting.
For small changes it is probably faster to run firebase serve. This spins up a local web server, so that you can test the changes. Once you're satisfied they work, publish them to Firebase Hosting with firebase deploy again.
Update: this is now possible through some custom scripting. See my answer here for details: Upload single file to firebase hosting via CLI or other without deleting existing ones?

Simply make the changes you want to and then type
npm run build
After this spin the server again using
firebase deploy
The changes you want will be updated.
You can also see the updated changes with the command
firebase serve
and then run firebase deploy when you're satisfied.

First of all Update all the coding and assets files in your local system then,
1) Go to the directory in the terminal by typing $ cd {add your directory}
2) Login on your terminal console by typing $ firebase login in the terminal
3) after login write $ firebase deploy
then, go to Hosting Section in your Firebase Console and delete the previously deployed files by deleting the previously added section in {Poject_Name} release history,
like this
enter image description here

Its a simple solution. This message is caused by the index.html file in your public folder being replaced with the index.html file provided by firebase.
All you have to do is navigate to the directory of your web app folder on your terminal and type in
$ rm .firebaserc
then
$ firebase init
after you've completed the firebase initialization, replace the new index.html file with the one inside the public folder and then type
$ firebase deploy

Related

I deploy firebase but I can not show my live web site. I shows "Welcome Firebase Hosting Setup Complete" when deployed to firebase hosting

The cause of the problem:
When we run the hosting commands, forget! What do you want to use as your public directory? y throw it away.
Step 1:
First of all build folder , .firebase , .firebaserc , firebase.json
Delete it.
Step 2:
*firebase init Give this command. Give the following steps correctly
1.What do you want to use as your public directory? build
2.Configure as a single-page app (rewrite all urls to /index.html)? Yes
3.Set up automatic builds and deploys with GitHub? No
4.File build/index.html already exists. Overwrite? Yes
5.npm run build
6.firebase deploy

How to deploy static files only to firebase hosting

I am just trying to create a static landing page for my app with firebase hosting. The first time initialized and deployed the site it worked fine, but now that I am trying to tweak the design a little bit and upload better images, somehow my index.html file keeps getting overwritten with code that I do not need, I believe it is the firebase default index page which they create when you first set up a projext. I have tried it three times now and it keeps happening, and each time I have to recreate all the edits.
How do I simply deploy static files without all the extra code overwriting the page?
I cd into the folder containing my site, the public folder, and run firebase init, chose only hosting, then chose no for one page app, then no for the git deploy scripts, then run firebase deploy --only hosting --project (my project)
Each time, my index file gets erased and replaced with a firebase spontaneously created file.
I have searched the firebase docs and can find no explanation.
Please help
Try just running the firebase deploy command. If you run the firebase init command the first time and select the project, and make the public folder, then you should only have to run that command once. cd into the folder, and then just run firebase deploy.

Cron jobs with firebase - Google Cloud IO error

I just recently set up Firebase functions. After making a simple helloWorld function work, I wanted to set up a cron job following this Google blog tutorial.
I always get an error at this step:
gcloud app deploy app.yaml \ cron.yaml
I get following error message:
C:\Users\vreee\Firebase\functions-cron\appengine>gcloud app deploy app.yaml \
cron.yaml
WARNING: Automatic app detection is deprecated and will soon be removed. As
an alternative, create an app.yaml file yourself using the directions at
https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml (App Engine Flexible Environment) or
https://cloud.google.com/appengine/docs/standard/python/config/appref (App
Engine Standard Environment) under the tab for your language.
Deployment to Google App Engine requires an app.yaml file. This
command will run `gcloud beta app gen-config` to generate an app.yaml
file for you in the current directory (if the current directory does
not contain an App Engine service, please answer "no").
Do you want to continue (Y/n)? y
This looks like a Python app. If so, please enter the command to run
the app in production (enter nothing if it's not a python app): :
Writing [app.yaml] to [C:\].
ERROR: gcloud crashed (IOError): [Errno 13] Permission denied:
u'C:\\app.yaml'
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
Anyone know how to solve this? I searched and set myself with my email address (not a service account) as the owner, so the permission should be there. I just notice that it tried to create an app.yaml file directly under C:\\ instead of the functions-cron folder containing an app.yaml and the cron.yaml file.
Would really appreciate the help!! For additional information, I am using windows..
It seems indeed that the Cloud SDK is trying to create an app.yaml file, which means there was no app.yaml file in your folder C:\Users\vreee\Firebase\functions-cron\appengine. As per the tutorial you linked, both app.yaml and cron.yaml files should be in that directory when you run the deploy command.
So your options are:
If you have already deployed an app and your app.yaml file hasn't changed (i.e it already declares the endpoint for your cron job), you can run the following command from your \functions-cron\appengine folder to upload the cron.yaml file only: gcloud app deploy cron.yaml.
Otherwise, you need to have both files within the same folder and run the command gcloud app deploy app.yaml cron.yaml.
In order for any Google App Engine deployment to work, a configuration file named "App.yaml" is necessary. There is an article in the official documentation about the possible parameters and configurations.
This issue doesn't looks like related to permissions to write in the cloud, but rather permissions to write in your local machine C:. My advice would be that you create the file before the deployment so gcloud doesn't need to be granted admin permissions to write in your local machine.

Why does firebase warn "* You are currently outside your home directory" during an init?

I am trying to deploy my first firebase app. I am getting the message "* You are currently outside your home directory" I googled it and found this reply
"commented on Dec 6, 2016
Just to make sure you're aware. If someone is experiencing the same problem with with the command firebase init
Make the files .firebaserc and firebase.json manually and the deploy should work normally."
I do not know where to create them or what the should contain.
I have also gone to https://www.npmjs.com/package/firebase-tools to try to fix this problem.
If any one can help with this problem I would appreciate it.
If anyone else worried about this just keep going. I continued with the deployment and it deployed OK.
download firebase CLI binary (in case you didn't download it yet. this is an .exe file if you use windows).
copy the downloaded file into your project's root folder (Folder which contains all the files and folders of your projects).
run the firebase-tools-instant-win_2.exe (firebase CLI binary).
a command window will open.
execute all your command in there.
Initialize a Firebase project
Many common tasks performed using the CLI, such as deploying to a Firebase project, require a project directory. You establish a project directory using the firebase init command. A project directory is usually the same directory as your source control root, and after running firebase init, the directory contains a firebase.json configuration file.
To initialize a new Firebase project, run the following command from within your app's directory:
I used firebase init project in my project's directory to get it to work

Firebase: error: unknown option `--public'

I am using this tutorial, after I successfully login to Firebase, I need to set the root dir. So as the tutorial instructs, I run:
~/firebase-webchat$ firebase init --public .
However, I get the following error:
error: unknown option `--public'
Does anyone know what command I should be using?
Thanks
I`ve having the same issue, but i finally get a answer for me.
First of all, do you will net logout from your firbase cli login, so lets run:
$ firebase logout
So thats should logout you.
So next lets login again, but at this time, we will need accept the follow question from firebase cli.
$ firebase login --no-localhost
? Allow Firebase to collect anonymous CLI usage information? Yes
If the ask from firebase not appears, just run
$ firebase login --reauth --no-localhost
So before continue, lets make some improvement on our directory structure, put all your files inside directory called "public"
So to the GRAND FINALE, just run
$ firebase init
I hope help you.
Don't use firebase init --public . -> you're probably following the same tutorial I was. Just use firebase init. You'll get asked to set your public directory later.
=== Hosting Setup
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
? What do you want to use as your public directory? .
Hope that helped.
After updating Node JS, i was able to deploy the project.
You can try the same by updating Node JS:
sudo npm install npm#latest -g
Not sure but after updating the node.js, i was able to select project from terminal and able to deploy the project using this commands:
firebase deploy
You can set project from terminal too.
firebase deploy -project your-project-id

Resources