【问题标题】:Cloud Container Builder authentication token issueCloud Container Builder 身份验证令牌问题
【发布时间】:2018-01-31 23:51:58
【问题描述】:

我尝试使用npm 构建器在Cloud Container Builder 上运行以下代码:

const Storage = require('@google-cloud/storage');
const storage = new Storage();
const bucketName = 'some-bucket-name';

test(`can access GCP`, async (t) => {
  await storage
    .createBucket(bucketName)
    .then(() => {
      console.log(`Bucket ${bucketName} created.`);
      t.pass();
    })
    .catch(err => {
      console.log(err);
      t.fail();
    });
});

当我这样做时,我收到了 404 page not found 错误。我该如何解决这个问题?

如果有帮助,我也尝试使用Data Loss Prevention API,但它给了我一个错误,说Getting metadata from plugin failed with error: Could not refresh access token.

谢谢!

【问题讨论】:

    标签: node.js google-cloud-platform google-cloud-storage google-container-builder


    【解决方案1】:

    这是由于 a bug 在 google-auto-auth 的依赖项中,从版本 0.9.2 开始修复。

    很遗憾,客户端库(例如@google-cloud/storage)尚未更新为使用此版本的google-auto-auth。在它们更新之前,您可以通过覆盖传递依赖项来解决此问题。如果您使用的是yarn(而不是npm),请将以下部分添加到您的package.json 文件中:

    "resolutions": {
      "google-auto-auth": "^0.9.2"
    }
    

    【讨论】:

      猜你喜欢
      • 2021-10-15
      • 2017-01-19
      • 1970-01-01
      • 2019-08-04
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 2015-10-07
      相关资源
      最近更新 更多