I have created some functions that upload and download files from firebase storage with cloud functions using the Firebase SDK and they work. I would like for the functions to be executed as admin so that they don't need to abide by the storage rules.
I have replaced the firebase SDK with the admin SDK but I found out that my firebase.storage().ref reference doesn't work anymore and by reading around some docs I have realized I now need to use the google cloud services system instead.
So my question is, is there a way to have a cloud function have administrator powers on the entire firebase project without having to switch to google cloud functions and if not, is there a work around to do that so that I can somehow authorize my cloud function to have full read/write powers on the entire storage? I am puzzled!
Here is a snippet of my code:
const firebase = require('firebase-admin');
const functions = require('firebase-functions');
require("firebase-admin")
require("firebase")
require("firebase/storage");
var serviceAccount = require("serviceAccount.json");
var config = {
[...]
credential: firebase.credential.cert(serviceAccount)
};
firebase.initializeApp(config);
var storage = firebase.storage();
var storageRef = storage.ref(); //This returns .ref() is not a function