I am building a site that is using Angular 4, Firebase, and Firebase Cloud Functions. What I am looking to do is when certain data is added to the database I want to add, remove, or update something in an RSS feed, sitemap, and JSON feed which are files hosted with Firebase Hosting.
Any suggestions on how to accomplish this or an alternative if it is not possible without manual updates and redeploys of the project?
There is currently no way to publish a new (or update a) file to Firebase Hosting based on a database (or other dynamic) trigger.
What is possible is to map a Cloud Function to a path on your site (e.g. /sitemap or /feed), generate the HTML in that Cloud Function, and then set caching headers on the result.
Related
I have installed the Search with Algolia extension into my firebase project, but after configuring the correct collection path ('listings) and inputting the Algolia Index Name and Algolia Application id. the index in Algolia is not registering updates to the collection. I get the message of 'No Records Yet'.
I have followed the video on the Algolia website, and it is installed into the correct project on firebase.
When clicking the 'How this extension works' tab, the link takes me to the Firebase realtime Database tab, and asks me to create a database. I can't see it requiring this anywhere in the Algolia extension, as currently my database is using the Firestore Database.
Do I need to switch to using the realtime Database for the extension to work, or should it also work with the Firestore Database?
The path to the collection set in the Extension Configuration is listings, should it projectName? listings? listings is the collection name though.
EDIT:
So another answer is listed here Firestore / Algolia integration fail: API key problem
The 400 error was down to insufficent permissions relating to the API key. The Admin API key will work, but you are better off creating a new API key with the desired permissions.
The Firebase Extension works with Firestore, so you should be good there. For the collection, it should just be as it is named in Firestore, so a collection named listings should just be configured as listings.
Do you have a transform function enabled on this extension? Or is that field left blank? (not a space either -- as this field can accept spaces)
Do you see any errors if you examine the logs for the Extension's function? To check this, navigate to Firebase > Functions and select the project you have installed the extension into. On the row for the function named ext-firestore-algolia-search-executeIndexOperation, hover over the right-hand side and click the three vertical dots. Click View Logs in this drop-down.
Are there any errors here that may help narrow down the issue?
I'm trying to access/download files that have been uploaded to Firebase storage but I can't figure out how to. Some of the files have a create new access token button under the storage location which gives me a link to the file on the web. Unfortunately, this is only a few files and seems to only be ones uploaded from localhost?
I can't find any reference to this on the documentation, this should be achievable through the Firebase dashboard?
I've tried setting the access rules to allow reads in all cases which hasn't helped.
Thanks
In general, you're supposed to use getDownloadURL(), as shown in the documentation, from within your web or mobile app to generate a download URL for use within your app. Typically, the console is only used to revoke the tokens that enable to download of each file through that URL.
If that's not specifically what you're trying to do, perhaps you want to read up on other was to make data public in Cloud Storage. The Firebase console is not really the best mechanism to manage downloadable content.
Today I have uploaded my website on Firebase hosting and in the process of doing that I have to create two rules files, one is storage.rules and another one is firestore.rules. I also have to create a firestore.indexes.json file. But I can remember previously I didn't have to create any such file while uploading another website on Firebas host.
I need to get rid of these 3 files, because every time I upload my files It changed to private rules for both storage and cloud which is unnecessary for me. I need to remain them public. Besides that I can't open these 2 rules files to edit (using Mac) just at least to see what is inside of them. How can I do it, Thanks!
It sounds like you use the Firebase CLI to initialize several products in the same project, including Cloud Storage and Firestore. If you don't want to work with these other products in your project files, you shouldn't select them during initialization.
The easiest thing to do would be to start over in a new directory and initialize only the products you want to use. It sounds like that's only Firebase Hosting.
You could also edit firebase.json and remove the products you don't want to use any more.
If you do want to work with Storage and Firestore, but you only want to deploy to Hosting, then just use firebas deploy --only hosting.
I'm using Firebase Cloud Functions to generate an HTML file and now I'd like to host it together with related assets (js, css, fonts etc.) but without success.
I call the function, it generates the file properly and puts it in Firebase Storage together with js/css/other assets. Now I would like to return a URL of the index.html file so that the user can access it in the browser and the .html page will have access to the assets. Unfortunately the generated URL enforces download but I'm pretty sure that even if I managed it somehow, it won't be able to access asset files.
I know it's possible on AWS (S3 bucket) but can I do it on Firebase? Firebase Hosting doesn't seem to be the right solution in that case, does it?
Don't save it to Storage, that's a bad use case for this scenario. Instead, save it to Hosting:
https://firebase.google.com/docs/hosting/
Also, you can consider serving the content directly from the cloud function, probably there's no need to create a static version first.
I have a Google spreadsheet with a list of image filenames in rows (e.g. tree01, tree02, car01, building01, etc.) and I have a Firebase Storage with a list of image files with the same name (e.g. tree01, tree02, car01, building01, etc.).
How can I get the filename in spreadsheet? Then use the filename to get a download URL in Firebase storage and then put the download URL back to the spreadsheet?
I know how to use Google App Script to r/w with spreadsheet. I have searched online that using Google Web App, using "Web Server for Chrome" and get the download URL from Firebase Storage, but I don't know how to put them together. Please help.
I solve my problem after studying some links. And following up with a useful links for my case.
passing data between google app script (.gs) and google web app (.html)
(https://developers.google.com/apps-script/guides/html/communication)
firebase storage tutorial for web app
(https://github.com/firebase/quickstart-js)
firebase database tutorial for google app script
(https://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/firebase)
I can now communicate between firebase-storage, firebase-database and google spreadsheet