This section has to be considered if you have purchased code that contains a “Firebase” or “FirebaseFunctions” folder inside.
All the necessary Firebase Functions have been initially coded by us, you just need to deploy these functions to your own Firebase account. This means that you need to upload the source code inside the FirebaseFunctions folder to your account. If a Firebase account has been created, find a Firebase project, and 2 apps (iOS and Android).
Step 1: Setting up Node.js and the Firebase CLIStep 2: Initialize your projectAn empty project containing sample code is created when you initialized Firebase SDK for cloud functions.
For initializing the project:
During initialization, package.json file is created that contains an important key: “engines”: {“node”: “12”}. Make sure it is Node.js version 12, before writing and deploying functions.
Step 3: Adding Foodie FunctionsAs we are providing the full source code for your Firebase Functions, all you need to do is add that source code into your newly created MyFirebaseFunctions project. Follow these steps to proceed:
Step 4: Deploy Firebase FunctionsTo deploy Firebase Functions, you need to make sure you upgrade your Firebase Pricing Plan to Blaze.
Simply run the command (firebase deploy –only functions) in the project directory
Now you can go to your Firebase Console and check, as the functions have been deployed. It is possible to see the logs for each function, understand the output, and know when it gets called.
Step 5: Watch Firebase Functions for ErrorsTo run properly, some Firebase functions need the creation of indexes on certain Firestore collections. Use the app and watch the logs for the Firebase Functions in the console. If you happen to get an error of missing index, simply click on the URL of that error, and the index will get created automatically. There is no need to deploy functions again, but wait until the index is created, before testing the app again.