When using file.createWriteStream when the file was created on a non-existent bucket, the stream does not error and essentially acts as if everything is fine. The only indication of error is the fact that no file is uploaded.
In the example below, one would expect the error event to trigger:
var gcloud = require('gcloud');
var storage = gcloud.storage({
keyFilename: process.env.GOOGLE_APPLICATION_CREDENTIALS,
projectId: process.env.GCLOUD_PROJECT_ID
})
var bucket = storage.bucket('this-bucket-does-not-exist');
var file = bucket.file('file.ext');
var stream = file.createWriteStream();
stream.on('error', function(){ console.log('Error'); });
stream.on('finish', function(){ console.log('Done'); });
stream.write('data');
stream.end();
When using file.createWriteStream when the file was created on a non-existent bucket, the stream does not error and essentially acts as if everything is fine. The only indication of error is the fact that no file is uploaded.
In the example below, one would expect the error event to trigger: