/lets-plan-firebase-functions

Cloud Functions for Firebase, for Let's Plan functionality.

Primary LanguageTypeScriptISC LicenseISC

Let's Plan logo

The status badge for this project's build FOSSA status The status badge for the Snyk-detected vulnerabilities count for this project

WebappInfrastructureFirebase Functions


Firebase Functions

A number of Firebase Gen 1 and Gen 2 Cloud Functions.

Functions

  • removeRelatedOnTripDelete - Triggered by trip delete. Deletes subcollections and, if uploaded, the Firebase Storage image (stored on the trip as trip.image)

screenshot of logs from removeRelatedOnTripDelete function

Setup

Set the .firebaserc file to use your firebase's project name. You need to enable the Cloud Build API and the Artifact Registry API to deploy from GitHub Actions.

To deploy functions when pushing to main branch, you'll need to set up the service account and workload identity federation as denoted in the terraform configuration.

After you've set that up, set up these action secrets on your repo:

  • WORKLOAD_IDENTITY_PROVIDER: The workload identity provider's "default audience", minus the iam.googleapis.com bit:

  • SERVICE_ACCOUNT: The email address service account you set up, e.g. my-service-account@my-project.iam.gserviceaccount.com

Finally, add the following roles to the IAM prinicpal ending in "@cloudbuild.gserviceaccount.com":

  • Firebase Admin
  • API Keys Admin