我尝试使用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.
谢谢!
答案 0 :(得分:0)
这是由a bug依赖google-auto-auth而导致的,{{3}}依赖于版本0.9.2
。
不幸的是,客户端库(例如@google-cloud/storage
)尚未更新为使用此版本的google-auto-auth
。在更新它们之前,您可以通过覆盖传递依赖项来解决此问题。如果您使用yarn
(而不是npm
),请将以下部分添加到package.json
文件中:
"resolutions": {
"google-auto-auth": "^0.9.2"
}