Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Cloud Functions and Firebase Functions?

Cloud Functions and Firebase Functions (or "Cloud Functions for Firebase") both look the same. Please describe the use case of each.

Both use HTTP functions.

In the Cloud Functions:

exports.helloHttp = function helloHttp (req, res) {   res.send(`Hello ${req.body.name || 'World'}!`); }; 

And in the Firebase Functions:

exports.helloWorld = functions.https.onRequest((request, response) => {   response.send("Hello from Firebase!"); }); 

What is difference between these?

like image 998
Muhammad chhota Avatar asked Mar 17 '17 10:03

Muhammad chhota


People also ask

What is Cloud Functions for Firebase?

Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.

What is the difference between Google Cloud and Firebase?

The new Firebase Storage is powered by Google Cloud Storage, giving it massive scalability and allowing stored files to be easily accessed by other projects running on Google Cloud Platform. Firebase now uses the same underlying account system as GCP, which means you can use any GCP product with your Firebase app.

What is cloud function?

Google Cloud Functions is a serverless execution environment for building and connecting cloud services. With Cloud Functions you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services. Your function is triggered when an event being watched is fired.

What is the difference between Cloud Functions and App Engine?

While App Engine supports many different services within a single application, Cloud Functions support individualized services. It's an important detail when comparing Google App Engine vs Cloud Functions. If your requirements don't include multiple services then Cloud Functions is a great choice.


1 Answers

There is no product called Firebase Functions.

There are three separate things:

  1. Google Cloud Functions, which allow you to run snippets of code in Google's infrastructure in response to events.
  2. Cloud Functions for Firebase, which triggers Google Cloud Functions based on events in Firebase (such as database or file writes, user creation, etc)
  3. Firebase SDK for Cloud Functions, which includes a library (confusingly called firebase-functions) that you use in your Functions code to access Firebase data (such as the snapshot of the data that was written to the database)

So Firebase provides a (relatively thin) wrapper around Google Cloud Functions, to make the latter product easier to use and integrate it with Firebase. In that senses it is similar to how Firebase integrates Google Cloud Storage into "Cloud Storage for Firebase" (formerly known as Firebase Storage).

If you're using Google Cloud Platform without Firebase, then you should use plain Google Cloud Functions. If you're on Firebase or if you're a mobile developer interested in Cloud Functions, you should use Cloud Functions for Firebase.

like image 170
Frank van Puffelen Avatar answered Oct 18 '22 10:10

Frank van Puffelen