-
Notifications
You must be signed in to change notification settings - Fork 962
Open
Description
[REQUIRED] Describe your environment
- Operating System version: iOS13.4
- Browser version: Mobile Safari
- Firebase SDK version: 7.9.1
- Firebase Product: Storage
[REQUIRED] Describe the problem
Firebase Storage UploadTask Snapshot does not progress and completion callback/promise is never returned.
I can see the file is created and uploaded properly using Firebase Console.
Steps to reproduce:
Upload a file using the firebase storage sdk, wait for task snapshot to return.
Expected result: File is uploaded and progress is reported, and a download URL is returned (this worked until fairly recently, and I cannot determine exactly why this isn't working anymore)
Actual output:
console.log: Writing image to DB as image.jpeg...
console.log: Waiting for upload to finish...
console.log: running Upload Progress 0
<Nothing happens here and there's no timeout>
Relevant Code:
const filename = "image.jpeg";
console.log(`Writing image to DB as ${filename}...`);
const uploadTask = firebase
.storage()
.ref()
.child(filename)
.put(blob, { contentType: "image/jpeg" });
uploadTask.on(
"state_changed",
function(snap) {
var progress = snap.bytesTransferred / snap.totalBytes / 100;
console.log(snap.state, "Upload Progress", progress);
},
function(err) {
console.error("Upload Error", err);
}
);
console.log("Waiting for upload to finish...");
await uploadTask.snapshot.ref
.getDownloadURL()
.then(url => {
console.log("Upload Completed");
resolve(url);
})
.catch(e => {
reject(e);
});