I'm trying to create a schedule Cloud Function exporting my Firestore database to create backups. The code is running fine when serving on my local machine (which uses my personal user account with owner role) but failes once deployed. I already found out that I need to add the 'Storage Admin' and 'Datastore Import Export Admin' to the service account used when running the cloud function, but I can't figure out which service account is used for the functions.
Does anyone know which service account is used?
Firebase Cloud Functions may use as App Engine default service account:
{project-id}@appspot.gserviceaccount.com
PROJECT_NUMBER-compute@developer.gserviceaccount.com
Roles and permissions added to those services accounts carry over to the Cloud Functions runtime.
Details on default firebase accounts is documented in Firebase Service Account Overview.
Good to know: When using Google Cloud Functions, the service account being used while running the function can be defined when deploying the function.