Step 2 - Publishing Cloud Functions to Firebase

F Firebase, Syncing and Functions / Cloud Functions Last updated on Updated Feb 05, 2019

After you have finished Step 1.  you will be able to upload the cloud functions in your firebase instance.


First, you will need to have Firebase Tools installed.

sudo npm install -g firebase-tools


Open the folder CloudFunction folder in terminal

Run the following sequence of commands, one by one


Initialize Firebase 

firebase init

Answer on the following questions

  1. Select Firebase Cloud Function with the Space Bar
  2. Select a default Firebase project for this directory:  -- Select your Firebase Instance
  3. What language would you like to use to write Cloud Functions?  -- JavaScript
  4. Do you want to use ESLint to catch probable bugs and enforce style? (y/N) - N
  5. File functions/package.json already exists. Overwrite? (y/N) - N
  6. File functions/index.js already exists. Overwrite? (y/N) - N
  7. File functions/.gitignore already exists. Overwrite? (y/N) - N
  8. Do you want to install dependencies with npm now? (Y/n)- y    <-- This will install the npm modules for Firebase

You will something like

Writing configuration info to firebase.json...
Writing project information to .firebaserc...
✔ Firebase initialization complete!


Now go inside the funcitons folder

cd functions

Then install the modules needed

npm install

Then upload the Functions to Firebase

firebase deploy --only functions


You will see something like


i  deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (56.79 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 6 function sendNotifyEmail(us-central1)...
i functions: updating Node.js 6 function crypteTheApplePassword(us-central1)...
i functions: updating Node.js 6 function saveAsGeostore(us-central1)...
i functions: updating Node.js 6 function paddleIntegration(us-central1)...
i functions: updating Node.js 6 function advancedSearch(us-central1)...
i functions: updating Node.js 6 function generateThumbnail(us-central1)...
i functions: updating Node.js 6 function saveVideoImage(us-central1)...
i functions: updating Node.js 6 function updateEventDateStartEndTime(us-central1)...
✔ functions[advancedSearch(us-central1)]: Successful update operation.
✔ functions[crypteTheApplePassword(us-central1)]: Successful update operation.
✔ functions[saveAsGeostore(us-central1)]: Successful update operation.
✔ functions[generateThumbnail(us-central1)]: Successful update operation.
✔ functions[sendNotifyEmail(us-central1)]: Successful update operation.
✔ functions[saveVideoImage(us-central1)]: Successful update operation.
✔ functions[paddleIntegration(us-central1)]: Successful update operation.
✔ functions[updateEventDateStartEndTime(us-central1)]: Successful update operation.


And you are done with uploading the cloud functions to firestore