Skip to content

Commit ce9e709

Browse files
committed
Handle external keystore error as user induced
1 parent c917051 commit ce9e709

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pkg/kmsplugin/kms.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ func ParseError(err error) (errorType KMSErrorType) {
8888
strings.Contains(ev.Message(), "does not exist in this region") {
8989
return KMSErrorTypeUserInduced
9090
}
91+
//Some times this error message is returned as part of KMSInvalidStateException or KMSInternalException
92+
case kms.ErrCodeInternalException:
93+
if strings.Contains(ev.Message(), "AWS KMS rejected the request because the external key store proxy did not respond in time. Retry the request. If you see this error repeatedly, report it to your external key store proxy administrator") {
94+
return KMSErrorTypeUserInduced
95+
}
9196
}
9297

9398
return KMSErrorTypeOther

pkg/plugin/plugin_v2_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ func TestEncryptV2(t *testing.T) {
156156
healthErr: true,
157157
checkErr: true,
158158
},
159+
{
160+
input: plainMessage,
161+
ctx: nil,
162+
output: "",
163+
err: awserr.New(kms.ErrCodeInternalException, "AWS KMS rejected the request because the external key store proxy did not respond in time. Retry the request. If you see this error repeatedly, report it to your external key store proxy administrator.", errors.New("fail")),
164+
errType: kmsplugin.KMSErrorTypeUserInduced,
165+
healthErr: true,
166+
checkErr: false,
167+
},
159168
}
160169

161170
c := &cloud.KMSMock{}

0 commit comments

Comments
 (0)