通过Cloud Storage触发的通过Cloud Functions下载的文件是否受到大小限制?

我有一个由google.storage.object.finalize上的存储桶触发的云功能。在此功能中,我下载了触发该功能的文件,并对数据进行了一些转换。如果此文件为〜5KB,则函数将按预期执行。如果文件约为200MB,则file.download回调将永远不会运行,并且Stackdriver除了Function execution took 14 ms,finished with status: 'ok'之外什么都不会显示。

我了解通过HTTP上传到HTTP触发功能的文件有10MB的限制,但是此功能是由Cloud Storage触发的。对this question的回答指出,存储触发功能没有施加10MB的限制,因此我怀疑可能存在超时问题。

该功能设置为2GB的内存限制,超时时间为5分钟,并且所有存储桶/功能都位于同一区域。当然,这将足够用于传输和处理200MB文件的资源(本地分析显示该过程在几秒钟内完成,而内存不足512MB)。

const { Storage } = require('@google-cloud/storage');
const storage = new Storage();
const uploadBucket = storage.bucket("<bucket name>");

module.exports = (data,context) => {

    console.log('Getting file ref');  // Logged regardless of file size
    const file = uploadBucket.file(<file name>);

    file.download(function (err,buffer) {
        console.log('Starting file processing');
        // With a smaller file,this callback runs as expected.
        // With larger files,this code is never reached.
    });
};

我是否对该功能和存储桶之间的可用带宽有不正确的了解,或者这暗示了另一个问题?

z376769188 回答:通过Cloud Storage触发的通过Cloud Functions下载的文件是否受到大小限制?

我能够将286.15 MB的文件从源存储桶复制到目标存储桶。 这是我的云功能。

exports.helloGCSGeneric = (data,context) => {

var storage = require('@google-cloud/storage')();


const bucket = storage.bucket(data.bucket);
const file = bucket.file(data.name); // file has couple of lines of text

var anotherBucket = storage.bucket('destination_bucket');

 file.copy(anotherBucket,function(err,copiedFile,apiResponse) {
});

 // or you can use 
 var newLocation = 'gs://another-bucket/new_file';
 file.copy(newLocation).then(function(data) {
 var newFile = data[0];
 var apiResponse = data[1];
 });
};

这是我的package.json文件:

 {
   "name": "sample-cloud-storage","version": "0.0.1","dependencies": {
   "@google-cloud/storage": "^1.6.0"
  }
 }

我只是触发了函数:

gsutil cp filename  gs://source_bucket/

根据文档Quotas & limits

  

存储在其中的单个对象的最大大小限制为5 TB   云存储。

本文链接:https://www.f2er.com/3155155.html

大家都在问