[Unhandled promise rejection: FirebaseError: Firebase Storage: Object 'post/Mfd7rHIi6sShBmcO5wHHfdDwlfE2/0.7bpr1c9ko5e' does not exist. (storage/object-not-found)]

689 views
Skip to first unread message

ARK Tutorials

unread,
Jul 16, 2022, 10:34:06 AM7/16/22
to Firebase Google Group
hi i'm getting an error. while tryign to upload a post on firestore . the image is saved in firebase storage. but the firestore says image not found. when i removed the download url in my save post function . the post was saved on fire store along eith image url.

[Unhandled promise rejection: FirebaseError: Firebase Storage: Object 'post/Mfd7rHIi6sShBmcO5wHHfdDwlfE2/0.7bpr1c9ko5e' does not exist. (storage/object-not-found)]


code:
const childpath= `post/${firebase.auth().currentUser.uid}/${Math.random().toString(36)}`; const submitPost = async () => { const response= await fetch(image.uri); //hogya 1 const blob=await response.blob(); // 2 const rref=firebase.storage().ref().child(childpath).put(blob); const taskCompleted = () => rref.snapshot.ref.getDownloadURL().then((snapshot) => { savePostdata(snapshot); console.log(snapshot) }) const taskerror= snapshot => { console.log(snapshot)} rref.on("state_Changed", taskCompleted ,taskerror) Alert.alert("Photo uploaded"); }; const savePostdata = (downloadURL) => { firebase.firestore() .collection('post') .doc(firebase.auth().currentUser.uid) .collection("userPosts") .add({ downloadURL, caption, creation: firebase.firestore.FieldValue.serverTimestamp(), }) } 
Reply all
Reply to author
Forward
0 new messages