Cloud Firestore 'Oops, collections failed to load!' - firebase

Trying to play around with the new Cloud Firestore but when I choose the firestore dropdown the datapanel says: 'Oops, collections failed to load!'
Is this attempting to import my existing realtimeDB into and failing or some other reason?
Thanks,
Ben

It's not.
You might see this error if the Cloud Firestore API is not enabled: Check on the Cloud Firestore API page after selecting your project name.
You might also see this if App Engine is disabled, since we rely upon some common infrastructure: Check on the App Engine Settings page to ensure it's not disabled after for your project.

Currently I'm seeing the same error on my Firefox browser but it's working well on Chrome!

I got the same issue and I solved it by cloud firestore API page and select a project. Then click enable the firestore API.

Related

How to Fix Permission Issues in Firebase Cloud Functions (Nextjs Experimental Hosting)

I have an issue related to Firestore, Hosting, and Cloud functions. I deployed a Nextjs application using the just-released experimental web framework support. I'm using Nextjs's Image API, and as expected, the Firebase CLI creates a cloud function for the project. Everything works fine at the start, but when I try to open a page in the application that reads some data from Firestore, it redirects to an auth page, which is unexpected.
Even when I auth with my Google account (since that's the logged-in user to the application), it returns a forbidden error and logs me out.
When I go back and try again, it returns a different error (most likely because I was logged out automatically).
I tried doing some research, and some people suggested adding an allUsers principal permission to Cloud functions, but that didn't work (Error: Principals of type allUsers and allAuthenticatedUsers cannot be added to this resource), and that's even insecure permission. Only authenticated users should be able to read data from the page as already configured in my Firestore security rules. So it's unclear what I need to do since Firebase created the Cloud function automatically or if this is related to my security rules and cloud functions.
What could be wrong? Everything works fine in my existing deployment setup to Netlify (where Edge functions are created automatically using their Nextjs plugin). I'm only trying to test the new Firebase web framework hosting features. Please let me know if you'd need me to provide some more context or debug files to better help you help me.
Thank you!
The message “ App requesting permission to access your google account “ pops up if the function runs in any region other than us-central1.
Currently, Firebase Hosting does not support Cloud Functions in any other regions, Except us-central1.
You can refer to this StackOverflow thread.

Extremely high READ hits on website using Firebase Firestore

I have more than 52k hits on my small project which is using NextJS with Firebase 9.
I don't know what the problem is because the data I am using is very limited and I have only two snapshot listener and one Authentication feature. But somehow in just two days Firestore quota has exceeded and there are more than 52k READ hits.
I don't know why that happened because there are no memory leaks and I am also closing the API listeners which come attached with Firebase.
I am providing github link in case anyone wants to take a look https://github.com/jainChetan81/Todo-List
Attached screenshot of Firebase console:
Use of the Firebase console will incur reads. If you leave the console open on a collection or document with busy write activity then the Firebase console will automatically read the changes that update the console's display. Most of the time this is the reason for unexpected high reads. You can go through this answer. Also, currently there are no tools to trace the reads in Firestore. So to limit the Firestore database reads you have to configure security rules.
So, I would suggest you check your Firestore rules. And if not, it is better to contact Firebase Support as this kind of issue needs visibility into your project and they will have access to it.
I am having the same problem as you with my React app. The solution is to use the useEffect hook and call the function that requests for firestore collection;
useEffect(()=> {
getPosts();
}, []);

Firebase Cloud Firebase: How to move data between projects in Native mode

I managed to move data between projects using the instructions as per this guide: Moving data between projects.
During the import, I got an error:
ERROR: (gcloud.firestore.import) PERMISSION_DENIED: The Cloud Firestore API has not been used in project XXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/firestore.googleapis.com/overview?project=project-name and then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
I enabled Cloud Firestore API and completed the import process.
Now, on Firebase console, when I go the Cloud Firestore page of the destination project, I see this message:
This project is set up to use Cloud Firestore in Datastore mode. This mode can only be accessed from Google Cloud Platform
The import command creates the Cloud Firestore database in Datastore mode. And it's not possible to switch it back Native mode as the first write on the database executed.
How can I import the data in Cloud Firestore Native mode?
I understand the import operation coerced the type of the new project database to Firestore in Datastore mode instead of Firestore Native, which was the mode of the database you exported the data from.
I have opened the following issue tracker so that this behavior could be investigated in further detail. I would recommend to star the issue and add your mail in the CC list so that you're aware of the updates made therein.
Separately, once the first write has been commited to the database it's no longer possible to change the database mode, therefore you'll have to create another project to use Firestore in Native mode.
To that effect I have tested the following workaround so that you could succesfully make the import in a new project:
Create a new project. Then go to the Firebase Console and create a Firestore database.
Using the console, create a mock collection and a mock document within it.
Proceed with the import as outlined in the documentation.
After completing these steps you could delete the mock collection and keep with your development as usual.

Error: HTTP error: 400, Project 'my_project' is not a Firestore enabled project

While I run the command firebase deploy I get this error:
Error: HTTP Error: 400, Project 'my_project' is not a Firestore enabled project.
Are you trying to use Cloud Firestore?
If so, visit the database section of the console and initialize Cloud Firestore
If not, remove the firestore.rules file locally
I figured it out myself. It was just an ignorance while using the firebase console. I just had to enable the firestore beta from the console itself, under Database.
If you’re not using Cloud Firestore, comment firestore in firebase.json
I had the same problem. The solution is this: Go to Firebase console and login there [Firebase console]. Here you will see your Recent projects. Go to your project e.g. “stepintothepresent” and then go to database at left side panel, then choose cloud firestore and then I selected the 2nd option.
After that I run firebase deploy from command prompt and the result is this
You can enable the REST APIs using below URL:
https://console.cloud.google.com/apis/library?project=
selected Cloud Firestore while initial firebase setup?
Just go to console and enable Cloud Firestore.
When prompted for once you can select test mode to start off and later change it to private.
I had to create a DB environment and it worked fine after that. I'm using the realtime DB, not Cloud storage so it shouldn't have stopped it, anyway, its fixed.
someone with another answer please.
Are you trying to use Cloud Firestore?
If so, visit the database section of the console and initialize Cloud Firestore
* Can you post the url please?
If not, remove the firestore.rules file locally
*Error: Error reading rules file firestore.rules

Using Firebase Analytics inside our android SDK

We're building SDK for Android apps which hopefully be used inside many android apps.
We need analytics both for ourselves and for the companies who would implement our SDK.
Does it make sense to implement firebase analytics inside our SDK in order to achieve this requirements?
(I know that it works with big query so I thought I might be able to gain lots of value from it.)
Is it even possible? (because of the JSON needed for the hosting app)
If it does make sense, what I really need is a list of pros and cons for using it in this scenario.
You can integrate Firebase Analytics within your app, then track who uses your SDK by logging a custom event and parameters or any other information that you need.
Note that custom parameters are not directly displayed in your Analytics reports, however you can link your app to BigQuery to see these data.
As of now, this is not possible.
There is an issue created for this on Github.
https://github.com/firebase/firebase-android-sdk/issues/66
Initialize FirebaseApp without google-services.json
FirebaseOptions options = new FirebaseOptions.Builder()
.setApplicationId(applicationID) // Required for Analytics.
.setApiKey(apiKey) // Required for Auth.
.build();
FirebaseApp.initializeApp(context, options);
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="${applicationId}.firebaseinitprovider"
tools:node="remove"/>
But the replies says as below:
Google Analytics for Firebase (GA4F) doesn't support dynamic
initialization. Our engineers are checking the possible solutions to
support this. It's just that we still haven't found a definite
timeline as to when (or if) this will be available. GA4F will not work
without the google-services.json file (or Gradle on your end). Even
though you can initialize the FirebaseApp dynamically through code,
GA4F will not recognize this and will only result in the error message
you are seeing. The scenario you are getting is only specific to
Google Analytics for Firebase. However, you can still use other
products like Firestore, Realtime Database, Storage even if you are
not using Gradle plugin.

Resources