When using the gem, we receive a deprecation warning.
aws-sigv4 1.0.3
Ruby 2.5.1, Linux
DEPRECATION WARNING: called deprecated method `secret_access_key' of an Aws::CredentialProvider, use #credentials instead
/app/shared/bundle/ruby/2.5.0/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:575:in `credentials_set?'
/app/shared/bundle/ruby/2.5.0/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:566:in `get_credentials'
/app/shared/bundle/ruby/2.5.0/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:204:in `sign_request'
/app/shared/bundle/ruby/2.5.0/gems/faraday_middleware-aws-sigv4-0.2.4/lib/faraday_middleware/request/aws_sigv4.rb:22:in `sign!'
signer.rb line 575 should be changed to not use the deprecated method
@atyndall
Thanks for opening this issue.
Can you provide an example of how you are instantiating your signer?
Closing this issue for inactivity.
I am having this issue as well. I'm using the faraday_middleware-aws-sigv4 gem, which in turn uses aws-sigv4. Here's how I set up that middleware:
f.request :aws_sigv4,
credentials: Aws::InstanceProfileCredentials.new,
service: 'es',
region: Environment.config['aws']['region']
Here's where the middleware instatiates the signer: https://github.com/winebarrel/faraday_middleware-aws-sigv4/blob/v0.2.4/lib/faraday_middleware/request/aws_sigv4.rb#L9
Here's one of the messages I'm getting.
DEPRECATION WARNING: called deprecated method `access_key_id' of an Aws::CredentialProvider, use #credentials instead
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:575:in `credentials_set?'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:566:in `get_credentials'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/aws-sigv4-1.0.3/lib/aws-sigv4/signer.rb:204:in `sign_request'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/faraday_middleware-aws-sigv4-0.2.4/lib/faraday_middleware/request/aws_sigv4.rb:22:in `sign!'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/faraday_middleware-aws-sigv4-0.2.4/lib/faraday_middleware/request/aws_sigv4.rb:14:in `call'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/elasticsearch-transport-6.1.0/lib/elasticsearch/transport/transport/http/faraday.rb:23:in `block in perform_request'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/elasticsearch-transport-6.1.0/lib/elasticsearch/transport/transport/base.rb:266:in `perform_request'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/elasticsearch-transport-6.1.0/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/elasticsearch-transport-6.1.0/lib/elasticsearch/transport/client.rb:131:in `perform_request'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/elasticsearch-api-6.1.0/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
/home/ubuntu/.rvm/gems/ruby-2.4.5/gems/elasticsearch-api-6.1.0/lib/elasticsearch/api/actions/indices/put_settings.rb:67:in `put_settings'
tasks/elasticsearch.rake:148:in `block (2 levels) in <top (required)>'
Hi @srchase any chance of reopening this one?
I too am seeing the issue and assumed I was the cause :)
After further investigation I believe the following line is the cause as it is calling #access_key_id which is deprecated as mentioned here in the docs.
@srchase I'm seeing exactly the same in the deprecation warnings as @divergentdave with a very similar use case.
gem 'aws-sdk-core', '3.46.2' # Provide API clients for AWS.
gem 'elasticsearch', '6.1.0'
gem 'faraday_middleware', '0.13.1'
gem 'faraday_middleware-aws-sigv4', '0.2.4'
On the off-chance this helps someone else, the cause for us was using credentials as the kwarg name when configuring the middleware.
Changing the middleware to using credentials_provider is the fix.
e.g. @divergentdave's example would change to
f.request :aws_sigv4,
credentials_provider: Aws::InstanceProfileCredentials.new,
# the change ^
service: 'es',
region: Environment.config['aws']['region']
@gondalez Where should i add this code? I'm using searchkick
@AhmedAliIbrahim I'm not familiar with searchkick but it looks like you change it wherever you configure searchkick. An initialiser perhaps?
This issue might help
https://github.com/ankane/searchkick/issues/1329
Most helpful comment
@srchase I'm seeing exactly the same in the deprecation warnings as @divergentdave with a very similar use case.
gem 'aws-sdk-core', '3.46.2' # Provide API clients for AWS.
gem 'elasticsearch', '6.1.0'
gem 'faraday_middleware', '0.13.1'
gem 'faraday_middleware-aws-sigv4', '0.2.4'