firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

Please disambiguate Realtime DB and "Database"

Open eugeneo opened this issue 3 years ago • 3 comments

Please rename firebase-functions/v2/database to firebase-functions/v2/realtime or onValue* triggers to onRealtimeValue*. This will save hours to your future clients!

[REQUIRED] Version info

node: 16

firebase-functions: 3.23.0

firebase-tools: (don't remember, should be latest)

firebase-admin: 11.0.1

[REQUIRED] Test case

It appears that internally Firebase team calls Realtime Database a "database" and Firestore something else. Unfortunately, it is not

[REQUIRED] Steps to reproduce

  1. Import firebase-functions/v2/database
  2. Use onValueUpdated trigger

[REQUIRED] Expected behavior

Trigger would react on Firestore changes

[REQUIRED] Actual behavior

Trigger is only for Realtime DB.

Were you able to successfully deploy your functions?

eugeneo avatar Sep 06 '22 16:09 eugeneo

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Sep 06 '22 16:09 google-oss-bot

Hi @eugeneo! Unfortunately, CF3v2 (i.e. GCF Gen 2 and EventArc) does not support Firestore as a trigger yet. When it becomes available, you will be able to create a Firestore triggers by importing various functions from firebase-functions/v2/firestore.

As for the suggested name change - we haven't considered changing the name (to something like firebase-functions/rtdb?). True that it is bit of a historical relic 🤔 but we didn't consider it confusing especially for existing CF3 users. I see why new users might find it confusing.

taeold avatar Sep 06 '22 16:09 taeold

Yes, I figured out that v2 functions can not be triggers. That's fine. This issue is specifically to make the names less ambiguous.

The errors I was getting were not helpful either - my project does not use RT DB so I was getting something like "missing namespace" as a deployment failure.

eugeneo avatar Sep 06 '22 16:09 eugeneo

The Firebase Realtime Database was the original Firebase product as a whole, let alone predating Firestore, so the client and admin SDK for JS put the realtime database SDK in the "database" namespace. We consider consistency to be a key feature of the SDK, so we will always put the realtime database in the "database" namespace unless or until the other SDKs make the same change.

inlined avatar Oct 18 '22 12:10 inlined