0
votes

I am planning to add two Firebase Function to keep track of number of elements at a location. One Firebase Function is triggered when an element is added to the location and increments the counter. Other function is triggered when an element is deleted and decrements the counter. An element could contain considerable amount of data. The Firebase functions are provided with the data at the location for which the function is triggered. I wanted to check if that data is counted towards outgoing bandwidth from the Realtime Database.

For example:

exports.incrementCounter = functions.database
  .ref('/tasks/{taskId}')
  .onCreate((taskSnapshot, context) => {
  // Increment a counter
  })

exports.deccrementCounter = functions.database
  .ref('/tasks/{taskId}')
  .onCreate((taskSnapshot, context) => {
  // Decrement a counter
  })

Is the data present in the taskSnapshot counted towards the outgoing bandwidth for the Firebase Realtime Database?

Ideally, if there were a way to get the number of children at a given location is Firebase Realtime Database, then I can just schedule a function to run every 5 mins and count the number of children at the location and report that but that functionality is not available at the moment.

1
What is Firebase Queue? There is not actually a product with that name. Could you edit the question to be more clear about the traffic you're concerned about? Maybe show some code the illustrates what you're doing? - Doug Stevenson
@DougStevenson Firebase queue isn't really important here. I just want to know the count of element at any location. Firebase queue is present here github.com/FirebaseExtended/firebase-queue. I have updated the question with some sample code and removed the Firebase queue part from it. - Varun Gupta

1 Answers

2
votes

Cloud Functions triggers that respond to Realtime Database updates do not bill egress from the database in the form of a snapshot delivered to the function.

If you have further questions about billing, please contact Firebase support directly. https://support.google.com/firebase/contact/support