![](/img/trans.png)
[英]Error: 3 INVALID_ARGUMENT: Invalid resource field value in the request
[英]Google Secret Manager INVALID_ARGUMENT Error
我正在使用 Google Secret Manager 訪問/存儲 API 中的一些秘密參數。保存秘密和訪問版本沒有問題。
但是當我發送請求列出這些機密時,我不斷收到此錯誤。
Error: 3 INVALID_ARGUMENT: Invalid resource field value in the request.
code: 3,
details: 'Invalid resource field value in the request.',
metadata: Metadata {
internalRepr: Map(3) {
'grpc-server-stats-bin' => [Array],
'google.rpc.errorinfo-bin' => [Array],
'grpc-status-details-bin' => [Array]
},
options: {}
},
statusDetails: [
ErrorInfo {
metadata: [Object],
reason: 'RESOURCE_PROJECT_INVALID',
domain: 'googleapis.com'
}
],
reason: 'RESOURCE_PROJECT_INVALID',
domain: 'googleapis.com',
errorInfoMetadata: {
method: 'google.cloud.secretmanager.v1.SecretManagerService.ListSecrets',
service: 'secretmanager.googleapis.com'
}
}
我還檢查了文檔並嘗試了像這里這樣的不同查詢,但沒有骰子......
這是我正在運行的代碼的一部分:
import { SecretManagerServiceClient } from "@google-cloud/secret-manager";
const secretClient = new SecretManagerServiceClient({
keyFile: "foo/bar/google_credentials.json"
});
const [secrets] = await secretClient.listSecrets({
filter: `labels.environment=development`
});
"@google-cloud/secret-manager": "^4.1.2",
好的,我發現了問題。 我必須將parent
參數添加到請求正文中。
所以它應該是這樣的:
const [secrets] = await SecretManager.secretClient.listSecrets({
parent: "projects/**", <=========== This is the key
filter: `
labels.environment:development AND
labels.scope:some-scope AND
labels.customer_id:*`
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.