Background functions

In addition to HTTP triggers, Google Cloud Functions can be triggered based on Pub/Sub messages, changes to files in Cloud Storage, Stackdriver logging, and Firebase events. These types of functions are collectively referred to as background functions. Background functions provide developers with a means to take action in response to changes in Google managed services.

Background functions differ in structure from HTTP functions in that they do not use the Express.js model (req, res) arguments. Instead, both Pub/Sub and Cloud Storage triggers accept event and callback arguments, where event contains any relevant data and callback provides a way to signal execution completion.