在尝试遵循示例代码以通过设置cryptohashconfig
来生成替代哈希的同时获取以下错误{ Error: In KmsWrappedCryptoKey
at Http2CallStream.call.on (/home/stoyak/Aritzia/dlp_api/node_modules/@google-cloud/dlp/node_modules/@grpc/grpc-js/build/src/client.js:103:45)
at Http2CallStream.emit (events.js:187:15)
at Http2CallStream.endCall (/home/stoyak/Aritzia/dlp_api/node_modules/@google-cloud/dlp/node_modules/@grpc/grpc-js/build/src/call-stream.js:74:18)
at handlingTrailers (/home/stoyak/Aritzia/dlp_api/node_modules/@google-cloud/dlp/node_modules/@grpc/grpc-js/build/src/call-stream.js:163:18)
at process._tickCallback (internal/process/next_tick.js:68:7)
code: 3,
details: 'In KmsWrappedCryptoKey',
metadata: Metadata { internalRepr: Map {} },
note:
'Exception occurred in retry method that was not classified as transient' }
这是使用的请求
{
"parent":"projects/XXXX",
"item":{
"value":"XXXXXXXX"
},
"deidentifyConfig":{
"infoTypeTransformations":{
"transformations":[
{
"primitiveTransformation":{
"cryptoHashConfig":{
"cryptoKey":{
"kmsWrapped":{
"wrappedKey":"CiQAnHQoiec0s1myvgJiQf+NjFKQ1MxzN2s+v/Jq74ek3tqhnRoSMAAEfzpfTLYI6jaMSRN4J8Q6wOZ0glgNF9UR9N+HxY+dhyTiggHwVQRnbrNnKU9MUw==",
"cryptoKeyName":"projects/XXXX/locations/global/keyRings/XXX/cryptoKeys/XXX"
}
},
"commonAlphabet":"ALPHA_NUMERIC"
}
}
}
]
}
}
}
代码3是无效的输入异常。我的猜测,如果您检查HTTP响应,您将获得更好的提示。
您要寻找的是看起来像这样的错误响应
{ "错误": { "代码":400, "消息":"该项目有一个错误……", "状态":" Invalid_argument", }}
要排除客户端库中的错误处理,您是否介意尝试通过API资源管理器尝试相同的调用?https://developers.google.com/apis-explorer/#p/dlp/v2/dlp.projects.content.deidentify