How can I solve the error ‘TS2532: Object is possibly ‘undefined’?

I’m trying to rebuild a web app example that uses Firebase Cloud Functions and Firestore. When deploying a function I get the following error: src/index.ts:45:18 – error TS2532: Object is possibly ‘undefined’. 45 const data = change.after.data(); This is the function: export const archiveChat = functions.firestore .document(“chats/{chatId}”) .onUpdate(change => { const data = change.after.data(); const … Read more

error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

First time using firestore and I’m getting this error. It seems to be a problem with Ivy, from my research. I don’t have a lot of experience modifying tsconfig.app.json, which is the direction I’ve been pointed to, following other answers. The only thing I was able to modify from the original project was to use … Read more

Difference Between Firestore Set with {merge: true} and Update

In Cloud Firestore there are three write operations: add() set() update() In the docs it says that using set(object, { merge: true }) will merge the given object with the existing document. The same happens when you use update(object)… so what is the difference? It seems strange that google would duplicate functionality like this. 5 … Read more

Separate dev and prod Firebase environment

I am considering using Firebase as MBaaS, however I couldn’t find any reliable solution to the following problem: I would like to set up two separate Firebase environments, one for development and one for production, but I don’t want to do a manual copy of features (eg. remote configuration setup, notification rules, etc.) between the … Read more

firestore: PERMISSION_DENIED: Missing or insufficient permissions

I am getting the Error gettingdocuments.com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions. for the below code on else statement db.collection(“users”) .get() .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { if (task.isSuccessful()) { for (DocumentSnapshot document : task.getResult()) { s(document.getId() + ” => ” + document.getData()); } } else { s(“Error getting documents.”+ task.getException()); } … Read more

What is Firebase Firestore ‘Reference’ data type good for?

I’m just exploring the new Firebase Firestore and it contains a data type called reference. It is not clear to me what this does. Is it like foreign key? Can it be used to point to a collection that is located somewhere else? If reference is an actual reference, can I use it for queries? … Read more

What’s the difference between Cloud Firestore and the Firebase Realtime Database?

Google just released Cloud Firestore, their new Document Database for apps. I have been reading the documentation but I don’t see a lot of differences between Firestore and Firebase DB. The main point is that Firestore uses documents and collections which allow the easy use of querying compared to Firebase, which is a traditional noSQL … Read more

No Firebase App ‘[DEFAULT]’ has been created – call Firebase.initializeApp() in Flutter and Firebase

I am building a Flutter application and I have integrated Firebase, but I keep getting this error when I click on a button either to register, login or logout. I have seen other people have asked the same question, but none seems to work for me. I am using Flutter and Android Studio. How can … Read more