Cloud Container Builder 身份验证令牌问题
Cloud Container Builder authentication token issue
我使用 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.
谢谢!
这是由于 a bug in a dependency of google-auto-auth 已在版本 0.9.2
中修复。
遗憾的是,客户端库(例如 @google-cloud/storage
)尚未更新为使用此版本的 google-auto-auth
。在更新它们之前,您可以通过覆盖传递依赖来解决这个问题。如果您使用 yarn
(而不是 npm
),请将以下部分添加到您的 package.json
文件中:
"resolutions": {
"google-auto-auth": "^0.9.2"
}
我使用 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.
谢谢!
这是由于 a bug in a dependency of google-auto-auth 已在版本 0.9.2
中修复。
遗憾的是,客户端库(例如 @google-cloud/storage
)尚未更新为使用此版本的 google-auto-auth
。在更新它们之前,您可以通过覆盖传递依赖来解决这个问题。如果您使用 yarn
(而不是 npm
),请将以下部分添加到您的 package.json
文件中:
"resolutions": {
"google-auto-auth": "^0.9.2"
}