【问题标题】:how handle "storage/retry-limit-exceeded" firebase storage web while uploading large file of size 1GB如何在上传大小为 1GB 的大文件时处理“存储/重试限制超出”firebase 存储网络
【发布时间】:2020-11-28 08:12:25
【问题描述】:

相关代码:

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);
    }
);

错误:

{ 代码_:“存储/重试限制超过”, message_: "Firebase 存储:已超出操作的最大重试时间,请重试。", serverResponse_:空,name_:“FirebaseError” }

【问题讨论】:

    标签: javascript web google-cloud-storage firebase-storage


    【解决方案1】:

    该错误实质上意味着:已超出操作(上传、下载、删除等)的最大时间限制。尝试重新上传。

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

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

    【讨论】:

    • 我用过 s3,效果很好。有时间我会测试你的建议。谢谢。
    猜你喜欢
    • 2016-11-18
    • 2019-07-19
    • 2017-01-13
    • 2012-07-28
    • 1970-01-01
    • 1970-01-01
    • 2020-09-23
    • 2019-10-15
    • 1970-01-01
    相关资源
    最近更新 更多