EC2::DescribeVpcs uses incorrect MaxResults value by default
ianbotsf opened this issue · comments
Describe the bug
Calling EC2's DescribeVpcs
API without providing an explicit MaxResults
causes an error about the parameter being invalid.
Expected behavior
The operation should succeed even when no parameters (including MaxResults
) are passed.
Current behavior
The operation fails:
Exception in thread "main" aws.sdk.kotlin.services.ec2.model.Ec2Exception: Value ( 0 ) for parameter MaxResults is invalid. Expecting a value greater than or equal to 5.
at aws.sdk.kotlin.services.ec2.transform.DescribeVpcsOperationDeserializerKt.throwDescribeVpcsError(DescribeVpcsOperationDeserializer.kt:64)
at aws.sdk.kotlin.services.ec2.transform.DescribeVpcsOperationDeserializerKt.access$throwDescribeVpcsError(DescribeVpcsOperationDeserializer.kt:1)
at aws.sdk.kotlin.services.ec2.transform.DescribeVpcsOperationDeserializerKt$throwDescribeVpcsError$1.invokeSuspend(DescribeVpcsOperationDeserializer.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at foo.ScratchKt.main(Scratch.kt:8)
at foo.ScratchKt.main(Scratch.kt)
Steps to Reproduce
Execute this code:
fun main(): Unit = runBlocking {
Ec2Client.fromEnvironment().use { ec2 ->
ec2.describeVpcs().vpcs?.forEach { println(it) }
}
}
Possible Solution
No response
Context
This same code runs successfully in 0.21.0-beta. Note that in that version, the body of the POST request is:
Action=DescribeVpcs&Version=2016-11-15
Note that no explicit MaxResults
is specified in the body, which is correct.
In 0.29.1-beta, the body of the POST request is:
Action=DescribeVpcs&Version=2016-11-15&DryRun=false&MaxResults=0
Note that MaxResults=0
is included and is clearly erroneous.
AWS Kotlin SDK version used
0.29.1-beta
Platform (JVM/JS/Native)
OpenJDK Runtime Environment Corretto-17.0.8.7.1 (build 17.0.8+7-LTS)
Operating System and version
Amazon Linux 2
The MaxResults
field in the Smithy model:
"MaxResults": {
"target": "com.amazonaws.ec2#DescribeVpcsMaxResults",
"traits": {
"smithy.api#clientOptional": {},
"smithy.api#default": 0,
"smithy.api#documentation": "(omitted)"
}
}
The clientOptional
annotation should supercede the default
trait but currently the SDK is incorrectly serializing MaxResults=0
in the request.
⚠️ COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.