aws-sdk-ruby icon indicating copy to clipboard operation
aws-sdk-ruby copied to clipboard

Fix Aws::RDS::Resource#create_db_cluster throws NoMethodError on nil

Open nekketsuuu opened this issue 1 year ago • 2 comments

When calling Aws::RDS::Resource#create_db_cluster, it throws an error because options[:db_cluster] is always nil here: https://github.com/aws/aws-sdk-ruby/blob/1db6f09105a81a7a856b0f825321faa10c6d822c/gems/aws-sdk-rds/lib/aws-sdk-rds/resource.rb#L959

This is because the definition of RDS resource is wrong. This patch fixes that small typo.

Reproduction steps to throw the error:

% bundle exec ruby -raws-sdk-rds -e 'Aws::RDS::Resource.new.create_db_cluster(db_cluster_identifier: "nekketsuuu-test", engine: "aurora-mysql", vpc_security_group_ids: ["REDACTED"], db_subnet_group_name: "REDACTED", master_username: "root", master_user_password: "REDACTED")'
/Users/nekketsuuu/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/aws-sdk-core-3.196.1/lib/aws-sdk-core/assume_role_web_identity_credentials.rb:5: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of aws-sdk-core-3.196.1 to add base64 into its gemspec.
/Users/nekketsuuu/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/aws-sdk-rds-1.232.0/lib/aws-sdk-rds/resource.rb:959:in `create_db_cluster': undefined method `[]' for nil (NoMethodError)

        id: options[:db_cluster][:db_cluster_identifier],
                                ^^^^^^^^^^^^^^^^^^^^^^^^
	from -e:1:in `<main>'
% ruby --version
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [arm64-darwin23]

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

nekketsuuu avatar Jul 01 '24 09:07 nekketsuuu

Hi! Thanks for opening a pull request. Unfortunately these need to be merged upstream by the service team. I'll reach out on your behalf so that they will prioritize this accordingly.

P138402889

jterapin avatar Jul 01 '24 15:07 jterapin

Closing since its not actionable by the Ruby team. We will post further correspondence from the service team on this thread.

Thanks, Ran~

RanVaknin avatar Jul 02 '24 21:07 RanVaknin

This should be fixed https://github.com/aws/aws-sdk-ruby/commit/b44000bfd007f43f905544067ff3774d6e9cf0a5#diff-c506ec621bd34841feb4d1c9dfe0c19008c3b60ec6bdc900592bff3718decefd

mullermp avatar Jul 12 '24 19:07 mullermp