Setting Up Firebase Functions
Working with functions is meant to be easy in FireSaaS. This guide will go over deploying the new user created function and working with / adding new functions.
Table of Contents
I prepackaged one function in this project. It creates database entries for your users when they create an account. Let's go ahead and deploy that now.
Node Version
I recommend using NVM (opens in a new tab) or if you're on Windows NVM-for-Windows (opens in a new tab) if you don't already to manage your node versions.
Firebase Functions requires Node 18, so make sure you have Node 18 installed globally or install it via NVM and use it.
nvm install 18nvm use 18Setup Firebase CLI
Make sure you have the Firebase CLI setup
npm install -g firebase-toolsThis installs firebase globally on your machine.
Now we login
firebase loginOnce you're logged in, cd into the functions directory
Then we can cd into functions and run yarn deploy, once this finishes your functions are live.
cd functionsYou MUST run yarn first to install dependencies.
yarnThen you can run deploy to deploy your functions to Firebase.
yarn deployTo deploy functions your Firebase account has to be on the Blaze account (Pay as you Go). Running deploy will prompt you to set this up if it isn't already.
Testing Functions Locally
You can run yarn serve inside the functions project to emulate functions locally. This is good for testing stuff out before you deploy.
yarn serve