1
votes

I'm trying to host my images on s3 but when I deploy my app to heroku it returns me an error:

Heroku log:

Completed 500 Internal Server Error in 14ms
2013-02-18T13:58:01+00:00 app[web.1]: 
2013-02-18T13:58:01+00:00 app[web.1]:     12:     <%= f.input :needshussler, as: :boolean, label: "Hussler" %>
2013-02-18T13:58:01+00:00 app[web.1]: ActionView::Template::Error (no such file to load -- aws-sdk (You may need to install the aws-sdk gem)):

I have created a bucket in amazon called startupcogs-pro

My config/s3.yml file contains:

development:


 bucket: startupcogs-dev
  access_key_id: ***
  secret_access_key: ***
production:
  bucket: startupcogs-pro
  access_key_id: ***
  secret_access_key: ***

My initializers/s3.rb contains:

if Rails.env == "production"
  # set credentials from ENV hash
  S3_CREDENTIALS = { :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET'], :bucket => ENV['S3_BUCKET']}
else
  # get credentials from YML file
  S3_CREDENTIALS = Rails.root.join("config/s3.yml")
end

My model has:

has_attached_file :image, :storage => :s3, :s3_credentials => S3_CREDENTIALS, styles: { large: "800x600>"}

And i set my heroku keys this way:

heroku config:add S3_KEY=*** S3_SECRET=*** S3_BUCKET=startupcogs-dev

Any help would be awesome! Struggling for some time now....

Thankyou

1
The error says "You may need to install the aws-sdk gem)". Do you have gem "aws-sdk" in your Gemfile?Rob Di Marco
Yes i do. It is working on my localhostTiago Martins
Actually fixed it, apparently I only had the aws-s3 gem! ThanksTiago Martins

1 Answers

1
votes

Apparently I only had the aws-s3 gem and not the aws-sdk gem as well!