My function is working fine when an image exists, in my case when I triggered the delete function image might not exist. when the image does not exist I am getting an error. ( DELETE https://firebasestorage.googleapis.com/v0/b/anayase-dc577.appspot.com/o/userimages%2Fcustomerimage%2Fa%20(2).jpg 404)
function DeleteImage(path, imgname) {
const storage = getStorage();
// Create a reference to the file to delete
const imageRef = ref(storage, path + '/' + imgname);
console.log(imageRef)
// Delete the file
deleteObject(imageRef).then(() => {
console.log("File Deleted Successfully")
}).catch((error) => {
console.log(error)
});
}