lundi 9 novembre 2015

Getting a TypeError: can't convert Hash into String using upload_file AWS-SDK v2 Ruby gem

I'm getting the following error when using the upload_file method from the AWS-SDK ruby gem:

TypeError: can't convert Hash into String
from <ROOTPATH>/.rvm/gems/ruby-1.9.3-p392@rms/gems/aws-sdk-core-2.1.33/lib/aws-sdk-core/signers/s3.rb:64:in `digest'

I'm only doing this:

require 'aws-sdk'

credentials = Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'])

Aws.config.update({region:ENV['AWS_REGION'],credentials: credentials})

s3 = Aws::S3::Resource.new 

s3.bucket(<BUKET_NAME>).object(<ANY_TEXT_FOR_KEY>).upload_file(<FILE_PATH_AS_STRING>)

I also pass the (region:ENV['AWS_REGION'],credentials: credentials) to the Resource.new but didn't work.

Any idea what is the TypeError related?

Thank in advance

Aucun commentaire:

Enregistrer un commentaire