Same Google Cloud Storage upload script works from one PC, but not the other, Why?

176 views Asked by At

I'm trying to upload a file to Google Cloud Storage from Node.JS (using gcloud package) with Service Account credentials and I get "invalid_grant" error (probably authorization error).

When I try to do this from another computer - it work fine, the error only occurs on my PC.

var gcloud = require('gcloud')({
    projectId: 'xxxxxxxxxxxxxx31032015',
    keyFilename: './keyfile.json'
});

var storage = gcloud.storage();

var bucket = storage.bucket('test.testBucket.com');

bucket.upload('test.png', function (err, file) {
    console.log(err);
});
1

There are 1 answers

1
Nick On BEST ANSWER

Some ideas:

  • Is the keyfile.json corresponding to a service account on your project?

  • Are you using the correct project id?

  • Is your system clock well-calibrated?

Good luck!