I'm using GCloud version 0.18.0. On my dev PC, I actually download very well file on Google Storage. But once the script is running on a Google Compute Engine, the download start and says it's complete but it's not. It's a log file so when I'm checking the downloaded log file, I see it's not completed. The beginning of the file is there.
I made so much search and no body looks like to have my problem.
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
});
The instance can talk with all Google API and anyway, it downloads a part of the log file.
I also tried to put a timer to give time to finish to write the file or something like that. No success. I'm never asking for help on forum, because I'm always finding a solution. But this one, I need help.