-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Secret Manager create secret throwing an exception #69
Comments
Thanks Scott. This looks like it's because our idempotency token provider is still just a dummy implementation. This will be fixed when 175157019 gets implemented. Verified this is the case by overriding the default (dummy) token generator: import aws.sdk.kotlin.runtime.AwsServiceException
import aws.sdk.kotlin.secretsmanager.model.CreateSecretRequest
import kotlinx.coroutines.runBlocking
import software.aws.clientrt.config.IdempotencyTokenProvider
import software.aws.clientrt.http.readAll
import software.aws.clientrt.http.response.HttpResponse
import java.util.*
fun main() = runBlocking {
val client = SecretsManagerClient {
region = "us-east-2"
idempotencyTokenProvider = IdempotencyTokenProvider { UUID.randomUUID().toString() }
}
try {
val req = CreateSecretRequest {
name = "FirstSecret20111"
description = "This secret was created by the AWS Secret Manager Kotlin API"
secretString = "3876555532989"
}
val resp = client.createSecret(req)
println("created secret: $resp")
}catch(ex: AwsServiceException) {
val httpResp = ex.protocolResponse as HttpResponse
println(httpResp)
println(httpResp.body.readAll()?.decodeToString())
println(ex)
}
client.close()
Unit
} |
It works now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When trying to create a new secret, an exception is thrown. Other SecretManager Kotlin examples work fine too.
NOTE - same issue for updateSecret as well
Code:
NOTE -- same code works via Java V2
Exception
HttpResponse(status=400: Bad Request, headers=Headers [content-length=[208], content-type=[application/x-amz-json-1.1], date=[Fri, 26 Feb 2021 19:52:33 GMT], x-amzn-requestid=[9726d237-4094-405d-b41e-f373eeb87514]], body=software.aws.clientrt.http.content.ByteArrayContent@16c9c4bd, request=HttpRequest(method=POST, url=https://secretsmanager.us-east-1.amazonaws.com/, headers=Headers [Host=[secretsmanager.us-east-1.amazonaws.com], X-Amz-Target=[secretsmanager.CreateSecret], Content-Type=[application/x-amz-json-1.1], X-Amz-Date=[20210226T195232Z], Authorization=[AWS4-HMAC-SHA256 Credential=AKIA33JWY3BXW7POHDLA/20210226/us-east-1/secretsmanager/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=59643ad2cafde3adeb92d98bc968038d69c7223f55978d07070c064197b4329c]], body=software.aws.clientrt.http.content.ByteArrayContent@63b77f34))
{"__type":"ValidationException","message":"1 validation error detected: Value '16143691511038666643' at 'clientRequestToken' failed to satisfy constraint: Member must have length greater than or equal to 32"}
aws.sdk.kotlin.runtime.UnknownServiceErrorException
Disconnected from the target VM, address: '127.0.0.1:61969', transport: 'socket'
The text was updated successfully, but these errors were encountered: