-
-
Save jemgold/3039543 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm having trouble uploading to S3 from Rails 3.1.5 using CarrierWave 0.5.8 and Fog 1.4.0. | |
CarrierWave worked fine storing files locally, the problem is with the Fog/S3 integration. | |
Tried removing the Rails.env.development? || Rails.env.production?, changing config.fog_public to false, changing the S3 region, and all the things I've commented out too. | |
Any ideas? | |
EDIT: forgot to add - my environment variables stored just fine - it looks like Fog isn't finding them at all though. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Rails.env.development? || Rails.env.production? | |
CarrierWave.configure do |config| | |
config.root = Rails.root.join('tmp') | |
config.cache_dir = 'uploads' | |
config.fog_credentials = { | |
:provider => 'AWS', # required | |
:aws_access_key_id => ENV['AWS_ACCESS_KEY'], # required | |
:aws_secret_access_key => ENV['AWS_SECRET'], # required | |
:region => 'eu-west-1' # optional, defaults to 'us-east-1' | |
} | |
config.fog_directory = 'fontlove' # required | |
config.fog_public = true # optional, defaults to true | |
# Other things I've tried putting in | |
# config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {} | |
#compute = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => ENV['AWS_ACCESS_KEY'], :aws_secret_access_key => ENV['AWS_SECRET']) | |
# config.fog_host = 'https://assets.example.com' # optional, defaults to nil | |
#config.storage = :fog | |
#storage = Fog::Storage.new(:provider => 'AWS', :aws_access_key_id => ENV['AWS_ACCESS_KEY'], :aws_secret_access_key => ENV['AWS_SECRET']) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[4] pry(main)> @image.save | |
(2.5ms) BEGIN | |
SQL (42.7ms) INSERT INTO "images" ("created_at", "font_id", "image", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["created_at", Mon, 02 Jul 2012 13:24:50 UTC +00:00], ["font_id", 14], ["image", "Garamond3.gif"], ["updated_at", Mon, 02 Jul 2012 13:24:50 UTC +00:00]] | |
(0.2ms) ROLLBACK | |
ArgumentError: Missing required arguments: aws_access_key_id | |
from /Users/Jon/.rvm/gems/ruby-1.9.3-p194@fontlove/gems/fog-1.4.0/lib/fog/core/service.rb:208:in `validate_options' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageUploader < CarrierWave::Uploader::Base | |
storage :fog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment