I am trying to run the Firestore trigger code below using Firebase emulators, firebase emulators:start
as you can see, inside the firestore trigger, I have a code to delete an image stored in Firebase Storage
my code:
exports.onDelete = functions
.firestore.document(path)
.onDelete((snapshot, context) => {
try {
const deletedUser = new User(snapshot.data());
const promise1 = db.doc(`devices/${deletedUser.uid}`).delete();
// deleting the image in Storage
const defaultBucket = storage.bucket();
const profilePictureFile = defaultBucket.file(`profilePicture/${deletedUser.uid}`);
const promise2 = profilePictureFile.delete();
const promises: Promise<any>[] = [promise1, promise2];
return Promise.all(promises);
} catch (error) {
console.log(error);
return Promise.reject(error);
}
});
because Firebase emulators currently doesn't have emulator for storage, so I expect there will be an error.
but I have a warning like this
as you can see at the very bottom, there is a warning that say
Your function was killed because it raised an unhandled error.
is this a serious error? I mean, I think I already provide the try catch block in my code, but why it is still considered as an unhandled error? how to solve this?
sorry, I am a beginner in Node, I am a mobile developer. so I am sorry if my question is a bit silly
