如何处理“超出存储/重试限制"; Firebase存储网络,同时上传大小为1GB的大文件 [英] how handle "storage/retry-limit-exceeded" firebase storage web while uploading large file of size 1GB

查看:101
本文介绍了如何处理“超出存储/重试限制"; Firebase存储网络,同时上传大小为1GB的大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相关代码:

var storageRef = firebase.storage().ref(file_path);
var uploadTask = storageRef.put(file);

uploadTask.on(
    'state_changed',
    function(snapshot) {
        // Observe state change events such as progress, pause, and resume
        // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
        var progress = snapshot.bytesTransferred / snapshot.totalBytes * 100;
        console.log('Upload is ' + progress + '% done');
        switch (snapshot.state) {
            case firebase.storage.TaskState.PAUSED: // or 'paused'
                console.log('Upload is paused');
                break;
            case firebase.storage.TaskState.RUNNING: // or 'running'
                console.log('Upload is running');
                break;
        }
    },
    function(error) {
        // Handle unsuccessful uploads
        console.warn('Unsuccessful upload', error);
    },
    function() {
        // Handle successful uploads on complete
        console.log('Image upload complete', uploadTask.snapshot.downloadURL);
        // Update the info about the post to point to the newly uploaded image
        ref
            .child(eventKey)
            .child('image')
            .set(uploadTask.snapshot.downloadURL);
    }
);

错误:

{ code_:超出存储/重试限制", message _:"Firebase存储:已超过操作的最大重试时间,请重试.", serverResponse_:null,name_:"FirebaseError" }

{ code_: "storage/retry-limit-exceeded", message_: "Firebase Storage: Max retry time for operation exceeded, please try again.", serverResponse_: null, name_: "FirebaseError" }

推荐答案

该错误实质上意味着:超出了操作(上传,下载,删除等)的最大时间限制.尝试再次上传.

The error essentially means: The maximum time limit on an operation (upload, download, delete, etc.) has been excceded. Try uploading again.

尝试使用maxUploadRetryTime [1]更改为上传重试设置的时间限制

Try changing the time limit set for upload retries using maxUploadRetryTime [1]

[1] https://firebase.google.com/docs/reference/js/firebase.storage.Storage

这篇关于如何处理“超出存储/重试限制"; Firebase存储网络,同时上传大小为1GB的大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆