我使用的是GCloud版本0.18.0。在我的开发PC上,我实际上在Google Storage上下载了非常好的文件。但是,一旦脚本在Google Compute Engine上运行,下载就会开始并说它已经完成,但事实并非如此。它是一个日志文件,所以当我检查下载的日志文件时,我发现它没有完成。文件的开头就在那里。
我做了很多搜索,没有身体看起来像我的问题。
var gcloud = require('gcloud')({projectId: project_id});
var bucket = google.storage.bucket('logs');
var log_one = {filename: 'test.log'};
bucket.file(log_one.filename).download({destination: './tmp/processing_' + log_one.filename}, function(err) {
if (err.code == 403 || err.code == 404 || err.message) {
console.log(err);
console.log("Error after bucket.file.download");
return;
}
console.log("Downloaded file " + log_one.filename + " completed");
// Do stuff on the log file <-- Which is here the file is incomplete on GCE
});
该实例可与所有Google API对话,无论如何,它会下载部分日志文件。
我还尝试放一个计时器,让时间完成写文件或类似的东西。没有成功。我从不在论坛上寻求帮助,因为我总能找到解决方案。但是这个,我需要帮助。
答案 0 :(得分:1)
自0.18.0以来,我们遇到了一些与流和流量相关的问题。完整的活动。升级到最新版本0.24.1可能会神奇地解决问题。