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

retry_errors#resolve_max_attempts is getting String from Shared_Config#max_attempts #2464

Closed
3 tasks done
tarcinil opened this issue Jan 14, 2021 · 3 comments · Fixed by #2465
Closed
3 tasks done
Labels
bug This issue is a bug. investigating Issue is being investigated

Comments

@tarcinil
Copy link

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
A clear and concise description of what the bug is.

While attempting to build up retry_logic with a default profile, SharedConfig is returning String for max_attempts where retry_errors#resolve_max_attempts expects it to be an Integer.

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

aws-sdk-core 3.111.0

Version of Ruby, OS environment
-paste the output of ruby -v

ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]

To Reproduce (observed behavior)

While trying to build up an S3 Client object with the following config:

[default]
max_attempts=6
retry_mode=standard
output=text
region=us-east-1
credentials = Aws::Credentials.new(access_key, secret_key)
@s3_client = Aws::S3::Client.new(
  region: REGION,
  credentials: credentials
)

Returns:

/Users/REDACTED/.rvm/gems/ruby-2.6.6/gems/aws-sdk-core-3.111.0/lib/aws-sdk-core/plugins/retry_errors.rb:184:in `resolve_max_attempts': Must provide a positive integer for max_attempts profile option or for ENV['AWS_MAX_ATTEMPTS'] (ArgumentError)

The method used by lib/aws-sdk-core/plugins/retry_errors.rb#resolve_max_attempts calls into Aws.shared_config.max_attempts(profile: cfg.profile) and this method is correctly return the value from the config file on the system, but it is returning it as a String rather than an Integer, which causes the next section of the resolve_max_attempts method to raise an ArgumentError.

[2] pry(Aws::Plugins::RetryErrors)> Aws.shared_config.max_attempts(profile: cfg.profile) 
=> "6"
[3] pry(Aws::Plugins::RetryErrors)> Aws.shared_config.max_attempts(profile: cfg.profile).class
=> String

Expected behavior
A clear and concise description of what you expected to happen.

[2] pry(Aws::Plugins::RetryErrors)> Aws.shared_config.max_attempts(profile: cfg.profile) 
=> 6
[3] pry(Aws::Plugins::RetryErrors)> Aws.shared_config.max_attempts(profile: cfg.profile).class
=> Integer

Screenshots
If applicable, add screenshots to help explain your problem.

N/A

Additional context
Add any other context about the problem here.

I was able to cast the return to an Integer in retry_errors via Aws.shared_config.max_attempts(profile: cfg.profile).to_i and have everything work as expected in retry_errors. I was also able to set the ENV for ENV['AWS_MAX_ATTEMPTS'] and have everything work as expected. It only seems to hit this condition when I am reading from a profile from .aws/config.

@tarcinil tarcinil added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 14, 2021
@mullermp
Copy link
Contributor

Related to #2319. Looking

@mullermp mullermp added investigating Issue is being investigated and removed needs-triage This issue or PR still needs to be triaged. labels Jan 14, 2021
@mullermp
Copy link
Contributor

Thanks for reporting this. I've made a PR at #2465 if you are interested.

@github-actions
Copy link

⚠️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.

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
Development

Successfully merging a pull request may close this issue.

2 participants