getting issue in the shared credentials path #2877
GadiVikram111
started this conversation in
General
Replies: 2 comments 2 replies
-
You shouldn't need to create an instance of shared credentials. The default profile should be loaded when you create your s3 client. |
Beta Was this translation helpful? Give feedback.
2 replies
-
The credential provider chain will automatically resolve the profile credentials - you can create your client with: s3 = Aws::S3::Client.new(
region: "us-east-1" # don't provide the `credentials` argument here, this will then use the credential provider chain and resolve credentials from the default profile.
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Getting below error while creating AWS client
shared_credentials.rb:36:in

initialize': undefined method
[]' for nil:NilClass (NoMethodError)User->aws->credentials
Code:
def uploadS3
credentials = Aws::SharedCredentials.new(ENV['default'])
s3 = Aws::S3::Client.new(
region: "us-east-1",
credentials: credentials
)
#Upload
puts "sending file to s3"
env=File.read('base/env.json')
env = JSON.parse(env)
time1= Time.new
time2=time1.strftime("%Y-%m-%d-%H-%M-%S")
filename="#{time2}-API-Automation-#{env['env_name']}-#{env['build_number']}"
puts filename
end
ERROR:
'C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.176.1/lib/aws-sdk-core/shared_credentials.rb:36:in
initialize': undefined method
[]' for nil:NilClass (NoMethodError)from ./send_xmltos3.rb:12:in
new' from ./send_xmltos3.rb:12:in
uploadS3'from ./send_xmltos3.rb:34:in `
Beta Was this translation helpful? Give feedback.
All reactions