Google Cloud Platform, GCP, has an article addressing this question, Google Cloud Functions and Firebase.
Google Cloud Functions and Firebase
Google Cloud Functions is Google's serverless compute solution for
creating event-driven applications. It is a joint product between the
Google Cloud Platform team and the Firebase team.
For Google Cloud Platform developers, Cloud
Functions serve as a connective
layer allowing you to weave logic between Google Cloud Platform (GCP)
services by listening for and responding to events.
For Firebase developers, Cloud Functions for
Firebase provides a way
to extend the behavior of Firebase and integrate Firebase features
through the addition of server-side code.
Both solutions provide fast and reliable execution of functions in a
fully managed environment where there's no need for you to worry about
managing any servers or provisioning any infrastructure.
...
Cloud Functions for Firebase is optimized for Firebase developers:
- Firebase SDK to configure your functions through code
- Integrated with Firebase Console and Firebase CLI
- The same triggers as Google Cloud Functions, plus Firebase Realtime Database, Firebase Authentication, and Firebase Analytics triggers