How long it takes for a firebase hosting to work? - firebase

I followed the instructions, and deployed a simple web yesterday. At first, it kept showing the default website, saying " you've deployed successfully...", not my web.
Also, the 'firebase open' command + "Hosting: Deployed Site" leads to a undefined site:' undefined.firebaseapp.com '.
But, magically, about an hour later when I open the link from 'firebase console' again, the web showed up... I am not sure whether 'firebase open' command worked cause I didn't try.
Today, I added some features, and deployed again. In the firebase CLI, it said deployed. But, the link still showed the old version.
I'll catch up an hours later to see whether it works, but even it works, it takes too long.
has anyone had the same experience? what's wrong with my web?
Thanks.

This is how I solved this issue for my angular 7 app deployment on Firebase hosting:
ng build --prod
go to dist/myproject and run command Firebase init and...
I went to dist/myproject that now contain build files along with Firebase related files. Copy all files except Firebase related files to dist folder in side dist/myproject.
there you will get overwrite warning just select overwrite option.
after copy process completes, run command Firebase deploy.
after completion of process go to shown URL and there you will find your running app.

Related

Firebase only hosts previous version of Flutter web app

I hosted my web application through Firebase using Flutter. Initially, it was absolutely fine but I realised there was a small error so changed it an redeployed it. However, when I ran flutter deploy it didn't change on the website. I thought that I might have to wait a while for the change to happen but I waited 5 hours and it still hasn't updated. I then tried a few more times, deleting different cache files but nothing worked. I then deleted the Firebase project all together and made a completely new one. I deleted the .firebaserc and firebase.json files. However, on the new website, it is still showing the old version of the website. I don't understand how that could be possible but any help would be really appreciated!
Visit your site from an incognito tab and validate. Also make sure you didn't forget to run flutter build web before firebase deploy.

Angular Universal + Firebase cloud functions deployment issue

I've been stuck on this issue for some time now.
My Angular project version is 9.0.3.
The #angular/fire version is 6.1.4
I have followed the guide here
The project builds and renders for the local Express server I have.
The problem occurs when I deploy the project to Firebase with a cloud function that will render the application.
Running the command ng deploy gives the below error
Error: ENOENT: no such file or directory, open '/home/teebo/Development/motf/dist/motif/browser/index.html'
This issue is linked to a reported issue here
I have investigated and found that in the project's dist folder, a index.original.html file is generated instead of index.html.
I have opened an issue here with no feedback from the maintainers.
If there is anything I am missing or there's something I can do to circumvent this issue, please share and any suggestions are appreciated.
Any suggestion, comment, anything.
I have found a way to circumvent this issue.
This is not a proper solution for the ng deploy issue but at least I can deploy the ssr function.
Because my dist folder is nested in another dist folder (Which does not include the browser build folder), that is why I was getting the error when running ng deploy. Below are steps I've followed to at least be able to deploy.
Run ng deploy (It will error out with the above error but will build the app and create a dist folder).
Copy the browser folder to the dist folder that does not have it (In my case I have copied it to a dist folder one level up).
Deploy the ssr function by running firebase deploy --only functions:ssr (You can change functions:ssr to whatever name you have named your function).
This worked for me;
It would save time to write an npm script to do all this but then; I am not sure if my firebase/universal config is wrong or there is a bug with #angular/fire.

Firebase Hosting and Github Action error "auth/invalid-api-key"

I'm using React for my project along with Firebase. Using Github Actions my code is successfully deployed to firebase.
But when I visit the hosted URL It gives me an error in the console saying
"Your API key is invalid, please check you have copied it correctly."
However when I deploy from the local system directly using firebase deploy It works fine.
I have taken the required care of my environment variables. But nothing seems to work.
It seems there is some problem while GitHub actions deploy the changes to firebase. Though all the build pass it gives me an error as stated above. Please Help.
This happen because GitHub actions don't have access to your .env on your local machine, you need to configure that on "GitHub Secrets" and put on your yml file.

NativeScript + Firebase, new firebase project is not being picked up

I am working with Master Detail with Firebase Angular template, and I can successfully build the app locally.
But then when I try to reconfigure the app for my own firebase project, nothing seems to change. It continues to query the default app's firebase.
I have followed the instructions for changing firebase app to my own to the letter but I cannot figure out why it still keeps pointing to the old app.
These are the steps I take to change the firebase app:
I create an App in Firebase, using the app id from package.json.
I download google-services.json and copy it to App_Resources/Android/google-services.json
Additionally, I delete google-services.json from platforms/android/app, just in case.
I uninstall the previously installed App from the emulator. I event deleted and created a new emulator to make sure there are no remnants of the previously built app.
I search all the files in the project for any reference for https://car-rental-b26b7.firebaseio.com which is the default firebase app that comes with the template, and I don't find anything at all.
I also edited firebase.common.ts with the following upon successful initialisation:
.then((instance) => console.log("firebase.init done", instance),
Just to see which project its initialising.
7. Finally, I build: tns run android
And sure enough, the console log shows https://car-rental-b26b7.firebaseio.com as the project being initialised.
I know for definite it is copying the new project's google-services.json over to platforms/android/app, because when I deleted the file it refused to build, as expected. Placing the file back, it builds successfully.
But I have no idea why it continues to reference the original firebase project.
Has anyone come across something similar?

firebase deploy not updating html file, not a cache issue

I'm doing a firebase deploy, but my local file does not match my served file. I have quadrupal checked the file that's in the deployed directory, I've disabled cache, I've hard reloaded, I've navigated directly to the file, I've made additional changes to the file, I've deployed from my local dev machine and from a clean CI server.
I navigate to http://localhost:3000/views/tasks.html and see one html result and then to https://[my-firebase-url]/views/tasks.html and see an older html result for the same file.
I've done firebase deploy --debug and everything is reported as successful and the file count is correct. Is there any additional information I can find out myself? Is there a way to look at the build that's uploaded to firebase mentioned in the debug file?
This has worked every time I've ever done it until now with the same project and file structure. Any way to troubleshoot this would be awesome. Thanks!
in my case I forgot to build(ng build --prod) the modified project to update the dist folder, which is uploaded on firebase server when deploy
As the comment by Frank van Puffelencheck mentioned, checking the Firebase status dashboard for the latest information is an additional step to take. If I had done that, I would have seen that the firebase deploy service was having issues at the time.
The issue for me was that I did not save the file. As i was working with bracket and seeing the modification, I forgot it.

Resources