personal-logger icon indicating copy to clipboard operation
personal-logger copied to clipboard

Replace Firebase/Firstore with something better

Open bvaughn opened this issue 6 years ago • 15 comments

In general, I've found Firebase to be awkward to work with- from authentication to querying.

Its support for compound queries is very limited. For example, it doesn't support logical OR or the "!=" operator, pushing the burden onto the client.

Its authentication model feels awkward too: Sessions aren't persisted between page reloads for some providers (eg Google). I was unable to get Facebook to actually work. etc.

Then tonight while testing the new summary page, I started seeing this error:

FirebaseError: [code=resource-exhausted]: Quota exceeded. Using maximum backoff delay to prevent overloading the backend.

This app has experienced very light traffic, so the above message is concerning.

Anyway, all of the Firebase-specific code is abstracted away behind DataStore so in theory, it should be easy enough to remove.

I asked for recommendations about this on Twitter some time ago, and based on the responses I got, Graph.cool seems like a good option to consider. This article compares GraphQL to Firebase and touches on some of the pain points mentioned above (like limited querying). Another possibility is AWS AppSync.

bvaughn avatar Jan 01 '18 04:01 bvaughn

If you want slightly better queryability, but also the real time factor, have a look at the new Cloud Firestore

mbrevda avatar Jan 01 '18 07:01 mbrevda

I've been using Firestore, since (legacy?) Firebase was pretty horrible to use for ordered lists.

bvaughn avatar Jan 01 '18 07:01 bvaughn

I see. (It's called the Firebase realtime database). Yeah, they are both quite limited!

On Mon, Jan 1, 2018, 9:17 AM Brian Vaughn [email protected] wrote:

I've been using Firestore, since (legacy?) Firebase was pretty horrible to use for ordered lists.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bvaughn/personal-logger/issues/27#issuecomment-354640125, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR4jJUqkDwL4ZjcYlxedtT16JNMOY0cks5tGIaagaJpZM4RP_cS .

mbrevda avatar Jan 01 '18 07:01 mbrevda

Thanks for the pointer though! I appreciate the thought.

Invested a decent amount of energy trying to get Fire* working for this project but it still feels...limited, awkward, and unintuitive to me.

Oh well. :smile:

Happy New Year buddy.

bvaughn avatar Jan 01 '18 07:01 bvaughn

You too!

On Mon, Jan 1, 2018, 9:27 AM Brian Vaughn [email protected] wrote:

Thanks for the pointer though! I appreciate the thought.

Invested a decent amount of energy trying to get Fire* working for this project but it still feels...limited, awkward, and unintuitive to me.

Oh well. :Smile:

Happy New Year buddy.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bvaughn/personal-logger/issues/27#issuecomment-354640509, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR4jBPGF7g_VlneIz7f1lIzJ8AZcWbOks5tGIjrgaJpZM4RP_cS .

mbrevda avatar Jan 01 '18 07:01 mbrevda

Added download/export option via #7 to support some kind of migration from Firebase to something else.

bvaughn avatar Jan 01 '18 17:01 bvaughn

Was thinking to myself that maybe it would be nice to support a couple of backends. I'm not thrilled with Firestore, but at least it works (if you overlook hacks like this). Maybe it would be possible to make an interface for DataStore and support a couple of implementations (Firebase, local storage, Graph.cool, etc.).

Maybe users could select which one to use before signing in (if we bundle-split) or maybe we could make it a build-time step.

This would be more work, and it might not be worth doing- particularly if certain backends support features that others don't. It's just a thought.

bvaughn avatar Jan 01 '18 18:01 bvaughn

I think I've run out of patience with Graph.cool, unfortunately. The docs seems to be wrong in so many places- either outdated (referencing functions/libs that don't exist anymore) or the code they show in the tutorial fails when run in the Playground, etc...

It looks like a nice service in many ways, although the auth example is pretty heavy on the boilerplate. I just don't have the time or patience to sort through the docs at the moment, since this is a side project.

bvaughn avatar Jan 03 '18 04:01 bvaughn

I also got this error while being the sole user of an app with at most 1 insert per second from the server.

FirebaseError: [code=resource-exhausted]: Quota exceeded. Using maximum backoff delay to prevent overloading the backend.`

Firestore is still in beta, and writes are capped to 1 per document per second, so that might have triggered the error.

dandv avatar Feb 20 '18 16:02 dandv

This warning just means that you guys have maxed out your free daily quota of reads and writes, you either need to bump up to a paid plan or wait a day for the quotas to be restored.

joshpitzalis avatar Apr 27 '18 03:04 joshpitzalis

Yeah, but as the issue description mentioned- the traffic/load for this app was super minimal to have already bumped up against the free tier limit. 😊

bvaughn avatar Apr 27 '18 05:04 bvaughn

It's not just traffic. There are a whole host of things that you could've maxed out if you're using apis, cloud functions, storage, etc. If you check the usage tab on firestore/rtdb next time it happens it will take you to a dashboard that shows you exactly what maxed out. app_engine_quotas_-_smart_spin_dev

joshpitzalis avatar Apr 27 '18 06:04 joshpitzalis

I was using the word "traffic" very broadly to mean reads and writes. The amount of data actually stored by this app is very small.

But good suggestion, thanks for mentioning the usage tab. 😊

bvaughn avatar Apr 27 '18 14:04 bvaughn

Google Cloud Datastore offers free quota that allows you to get started at no cost. The resources and free quota amounts are listed below. If you need more quota, you must enable billing and set a spending limit for your project.

Quotas are applied daily and reset around midnight Pacific time.

image

ronnieroyston avatar Jun 25 '18 02:06 ronnieroyston

Is there a limit on Cloud messages as well ? I cant find any documentation on the quota of messages.

thevzurd avatar Mar 03 '19 18:03 thevzurd