Skip to main content

Posts

Showing posts from September, 2021

Firebase collection backup script

 If you need save some separate collection on your computer or you want backup your data outside of Firebase and default options on Google bucket.  Working together firestore.client and tinyDb you can store your data on your computer or any other server. Google has a well-functioning system for import / export data, but in exceptional cases it needs extra copy, then you can execute it with such a script.         dbfile = "data/CategoryToLabelMapper.json"         cred = credentials.Certificate("firebase-adminsdk-m3mts-d27dbb2c96.json")         firebase_admin.initialize_app(cred)         db = firestore.client()         tiny = TinyDB(dbfile)         collection = db.collection('CategoryToLabelMapper')         docs = collection.stream()         for doc in docs:             dic = doc.to_dict()              tiny.insert({doc.id: dic})   So, your export file will be something like this.    For default solution please follow this documentation.  https://firebase.go

Setup Firebase Hosting and custom domain

  First  step: Create a new project in your account.. In command line firebase init Follow the steps in Wizard and choose the project that you want to use.  If you get some errors like  Error: It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/vacaturemailscom/firestore to create your Cloud Firestore database. % firebase init Or Error: Your project vacaturemailscom must be on the Blaze (pay-as-you-go) plan to complete this command. Required API cloudbuild.googleapis.com can't be enabled until the upgrade is complete. To upgrade, visit the following URL You can fix this problem by using the firebase admin panel.  When Firebase initialization completes.  You can use command  firebase deploy So, now after first deploy you can add custom domain Add TXT records in your DNS so hosting can verify your ownership.  If you get this error message.  If you receive this message then you have to wait for DNS renewal for ma