【问题标题】:Same Google Cloud Storage upload script works from one PC, but not the other, Why?相同的 Google Cloud Storage 上传脚本可以在一台 PC 上运行,但不能在另一台 PC 上运行,为什么?
【发布时间】:2015-06-17 09:27:15
【问题描述】:

我正在尝试使用服务帐户凭据从 Node.JS(使用 gcloud 包)将文件上传到 Google Cloud Storage,但我收到“invalid_grant”错误(可能是授权错误)。

当我尝试从另一台计算机上执行此操作时 - 它工作正常,但该错误仅发生在我的 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);
});

【问题讨论】:

    标签: node.js google-cloud-storage google-authentication gcloud-node


    【解决方案1】:

    一些想法:

    • keyfile.json 是否对应您项目中的服务帐号?

    • 您使用的项目 ID 是否正确?

    • 您的系统时钟是否校准良好?

    祝你好运!

    【讨论】:

    • 嘿,我很高兴听到这个消息。是的,如果系统时钟没有充分同步,为实时流设计的加密程序通常会失败。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-10
    • 2020-05-17
    • 1970-01-01
    • 1970-01-01
    • 2020-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多