Javascript 如何处理;超出存储/重试限制”;上载1GB大小的大文件时,firebase存储web

Javascript 如何处理;超出存储/重试限制”;上载1GB大小的大文件时,firebase存储web,javascript,web,google-cloud-storage,firebase-storage,Javascript,Web,Google Cloud Storage,Firebase Storage,相关代码: 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 t

相关代码:

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);
    }
);
错误:

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);
    }
);
{ 代码:“超出存储/重试限制”, 消息:“Firebase存储:已超过操作的最大重试时间,请重试。”, serverResponse:null,名称:FirebaseError
}该错误本质上意味着:操作(上传、下载、删除等)的最长时间限制已被取消。请再次尝试上载

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


[1]

我用的是s3,工作起来很有魅力。有时间我会检验你的建议。非常感谢。