I am trying to capture an image from react-camera-pro and uploading it in my firebase database.
The request contains the image but it is showing 404 error while uploading to url: https://firebasestorage.googleapis.com/v0/b/{my-database-name}-c2bf2.appspot.com/o?name=images%2F1722751454516.jpg
This is the error on the runtime
I am using this code to capture and upload image
const captureAndUploadImage = async () => {
console.log("Entered capture");
if (camera.current) {
const imageSrc = camera.current.takePhoto();
// Convert base64 image to a Blob
const response = await fetch(imageSrc);
const blob = await response.blob();
// Upload the image to Firebase Storage
const storageRef = ref(storage, `images/${Date.now()}.jpg`);
await uploadBytes(storageRef, blob);
// Get the download URL
const downloadURL = await getDownloadURL(storageRef);
console.log("File available at", downloadURL);
}
};
I tried uploading the image to firebase as images/{name}.jpg but it giving me 404 error