All my functions used to be in a single index.js file, and everything worked properly. Now, I have divided up my functions into different files for the different functions, but one function is not working.
My index file begins like this:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
The file for the function that is not working begins like this:
const functions = require('firebase-functions');
const index = require('./index')
exports.deleteOtherData = functions.firestore
.document('attempts/{attemptId}')
.onDelete((snapshot, context) => {
const rawVideoBucket = index.admin.storage().bucket('my-bucket-name');
I am now getting this error:
"TypeError: Cannot read property 'storage' of undefined"
Why? Can't I reference the admin property from the index file?