Skip to content
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

Aws::EC2::Resources raises InvalidParameterCombination when some parameters are specified #3028

Closed
yasuoza opened this issue May 21, 2024 · 2 comments · Fixed by #3029
Closed
Assignees
Labels
bug This issue is a bug. investigating Issue is being investigated

Comments

@yasuoza
Copy link
Contributor

yasuoza commented May 21, 2024

Describe the bug

Some AWS APIs are not allowed to use MaxResults parameter.

But aws-sdk-ec2 >= 1.448.1 automatically sets max_results.

For that reason, Aws::EC2::Errors::InvalidParameterCombination will be raised some parameter conditions.

AFIK, the following parameters are not allowed to use MaxResults simultaneously.

Aws::EC2::Resources#images

  • ImageId.N

Aws::EC2::Resources#instances

You cannot specify this parameter and the instance IDs parameter in the same request.

  • InstanceId.N

Aws::EC2::Resources#snapshots

You cannot specify this parameter and the snapshot IDs parameter in the same request.

  • SnapshotId.N

Aws::EC2::Resources#volumes

You cannot specify this parameter and the volume IDs parameter in the same request.

  • VolumeId.N

Expected Behavior

Aws::EC2::Resources does not set max_results automatically when the given options contains the parameter which cannot be used with max_results in the same request.

Current Behavior

Aws::EC2::Resources setsmax_results automatically even if the given options contains the parameter which cannot be used with max_results in the same request.

Reproduction Steps

Use aws-sdk-ec2 >= 1.448.1

Raises Aws::EC2::Errors::InvalidParameterCombination

require "aws-sdk-ec2"

ec2 = Aws::EC2::Resource.new
ec2.images(
  owners: ["self"],
  image_ids: %w[ami-1234567890abc],  # whatever the value
).to_a

# raises The parameter imageIdsSet cannot be used with the parameter maxResults (Aws::EC2::Errors::InvalidParameterCombination)

Dose not raise Aws::EC2::Errors::InvalidParameterCombination

require "aws-sdk-ec2"

ec2 = Aws::EC2::Resource.new
ec2.images(
  owners: ["self"],
).to_a

Possible Solution

Do not set max_results if the options contains parameter which cannot be used with max_results.

Additional Information/Context

No response

Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

aws-sdk-ec2

Environment details (Version of Ruby, OS environment)

Ruby >= 2.7, aws-sdk-ec2 >= 1.448.1

@yasuoza yasuoza added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 21, 2024
@alextwoods alextwoods self-assigned this May 21, 2024
@alextwoods alextwoods added investigating Issue is being investigated and removed needs-triage This issue or PR still needs to be triaged. labels May 21, 2024
@alextwoods
Copy link
Contributor

Hey sorry you are running into this and thank you for submitting a PR - I'm reviewing and trying to confirm a complete list of incompatible parameters.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. investigating Issue is being investigated
Projects
None yet
2 participants