Varun Gupta
Varun Gupta

Reputation: 3112

Is data passed in Firebase Function for database trigger counted towards outgoing bandwidth?

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.

Upvotes: 0

Views: 153

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317467

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

Upvotes: 2

Related Questions