Firebase Storage not storing my firestorage download url
- Operating System version: MAC OS X
- Firebase SDK version: 4.10.0
- Firebase Product: storage
let uploadBlob = null;
const imageRef = firebase.storage().ref('profile-Photos').child(firebase.auth().currentUser.email + '.jpg');
let mime = 'image/jpg';
//THIS ADDS IMAGE TO FIRE STORAGE AND PULLS URL
fs.readFile(image, 'base64')
.then((data) => {
return Blob.build(data, { type: `${mime};BASE64` })
})
.then((blob) => {
uploadBlob = blob
return imageRef.put(blob, { contentType: mime })
})
.then(() => {
uploadBlob.close()
return imageRef.getDownloadURL()
})
.then((url) => {
// URL of the image uploaded on Firebase storage
console.log('my url is' , url);
this.setState({profPic: url})
console.log('new prof pic:', this.state.profPic)
})
.catch((error) => {
console.log(error);
})
}
//this queries the specific users document and updates fields, the state is properly passed
//the state is also a string
fetchChanges = () => {
console.log('i want to put this', this.state.profPic)
console.log(typeof this.state.profPic)
db.collection('users').doc(this.state.userID).set({
'firstName': this.state.firstName,
'lastName': this.state.lastName,
'office': this.state.office,
'bio': this.state.bio,
'proPic': this.state.profPic
})
}
Hi all, been trying to workout this bug for hours and can't seem to be getting anywhere. Quick background, I'm running firebase version 4.10.0. The issue Im having here is that I'm using RN fetch blob and everything to store the blob into my firestorage and then pulling the download URL.
What i want to do next is store this download url in a specific users document for profile photos but the query or 'update' function wont go through when doing so. I've done multiple console logs and my data is being passed appropriately and I am pulling the url from storage. BUT when I want to update my 'proPic' field the entire query does not happen.
I've tested this by doing every other query without profile picture and it works perfect fine but when including profile picture and fetching the url etc the function does not do anything. I've tried setting the document as well as update and got no luck.
I can update all other fields but once my fetch blob is done and pulls the download URL, nothing will work.
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.
This issues does not have all the required information. Looks like you forgot to fill out some sections. Please update the issue with more information.
I'm having this issue as well.
vm.uploadTask = fbstorage.ref(res.getKey()+'.jpg').put(file);
vm.uploadTask.then(snapshot => {
vm.downloadURL = vm.uploadTask.snapshot.downloadURL;
console.log('url', vm.downloadURL)
fbdb.ref().child('/patterns/' + fbauth.currentUser.uid + '/' + res.getKey())
.update({ imageUrl: vm.downloadURL }).then(res => {
});
vm.selectedImageId = res.getKey()
})
This used to work, but now the console.log('url', vm.downloadURL) returns undefined. This used to work and stopped working between last weekend and this weekend.
It looks like these may be two separate issues. @mjalindahl We removed the downloadURL property in 5.0.0. You should use the Reference.getDownloadURL method instead now.
@eawwal I'll take a closer look.
I have the same problem. I upload image using blob, and ref.put() method from Store. The image is uploaded correctly but after that I try to access a Firestore DB document and I get the error "Failed to get document because the client is offline". But mi connectios is good. And When disable the upload file the access to document is great. I shared my code here.
let uploadBlob = null;
const mime = 'image/jpg';
fs.readFile(imageUri, 'base64')
.then((data) => {
return Blob.build(data, { type: ${mime};BASE64 });
})
.then((blob) => {
uploadBlob = blob;
return imageRef.put(blob, { contentType: mime });
})
.then(() => {
uploadBlob.close();
return imageRef.getDownloadURL();
})
.then((url) => {
return url;
})
.catch((error) => {
console.log('error in Image!');
console.log(error);
});
Plis, I've been looking for a solution for days and I can't find it. It is difficult to google this problem.
@nicolasscard: "Failed to get document because the client is offline" is an error message from Firestore. There are number of possible root causes, but we would need more information. Do you mind following up with a Firestore specific issue (depending on where your error message occurs - either firebase-android-sdk, firebase-ios-sdk or here).
Dear, The error appears after trying to access a document from the Firestore database. But not in any situation, only after uploading a photo to the store.The photo is uploaded correctly, it does not give any problems, but something has to be happening with the client session because any request after the image is uploaded is rejected with this error.regardsEnviado desde mi smartphone Samsung Galaxy. -------- Mensaje original --------De: Sebastian Schmidt [email protected] Fecha: 9/12/19 20:32 (GMT-03:00) A: firebase/firebase-js-sdk [email protected] CC: Nicolas Scardilla [email protected], Mention [email protected] Asunto: Re: [firebase/firebase-js-sdk] Firebase Storage not storing my firestorage download url (#611) @nicolasscard: "Failed to get document because the client is offline" is an error message from Firestore. There are number of possible root causes, but we would need more information. Do you mind following up with a Firestore specific issue (depending on where your error message occurs - either firebase-android-sdk, firebase-ios-sdk or here).
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/firebase/firebase-js-sdk/issues/611?email_source=notifications\u0026email_token=AIRGHADAUPHKX7HEXLHBLTLQX3IR5A5CNFSM4EYJKUM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGLCQ4Y#issuecomment-563488883", "url": "https://github.com/firebase/firebase-js-sdk/issues/611?email_source=notifications\u0026email_token=AIRGHADAUPHKX7HEXLHBLTLQX3IR5A5CNFSM4EYJKUM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGLCQ4Y#issuecomment-563488883", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
Firestore and Cloud Storage use different networking stacks, and your problem seems to be related to Firestore. If you can post debug logs for Firestore (FirebaseFirestore.setLoggingEnabled(true)) we might be able to see what is going on
Any updates on this issue? I'm having the same issue
Whe tried to ejecute firebase.firestore.setLoggingEnabled(true); I received an error about the function is undefined.
I adjunct images from my files whit the code, whats libraries I use with React Native and how user this. Plis check the file images and answer me what can I be doing wrong. The image is uploaded correctly and I didn´t have any error, but whe i tried to excecute samething else, the app is not responding...
Please help me!! I don't undestend whats is the problem and I don't know what else to do. Regards
El vie., 13 de dic. de 2019 a la(s) 19:40, Sebastian Schmidt ( [email protected]) escribió:
Firestore and Cloud Storage use different networking stacks, and your problem seems to be related to Firestore. If you can post debug logs for Firestore (FirebaseFirestore.setLoggingEnabled(true)) we might be able to see what is going on
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-js-sdk/issues/611?email_source=notifications&email_token=AIRGHAFZSBPDPH27WARN5S3QYQFNJA5CNFSM4EYJKUM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3OXZA#issuecomment-565636068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRGHACKYXBYKREXRG5D4X3QYQFNJANCNFSM4EYJKUMQ .
Unfortunately, without a reproduction or debug logs we will not be able to provide much useful help. Do note that that I was wrong about how to turn on logging - it is not setLoggingEnabled but rather setLogLevel. Apologies!
Please take a look here for how to enable our debug logs: https://firebase.google.com/docs/reference/js/firebase.firestore.html#setloglevel
Closing this due to inactivity. Please re-open if this is still an issue.