amazon s3 - S3 storage fails with fog 0.7.2 + carrierwave master branch -
when trying store file following:
typeerror: can't convert nil string /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/core/hmac.rb:23:in `digest' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/core/hmac.rb:23:in `block in setup_sha1' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/core/hmac.rb:15:in `call' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/core/hmac.rb:15:in `sign' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/storage/aws.rb:309:in `signature' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/storage/aws.rb:317:in `request' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/storage/requests/aws/put_object.rb:43:in `put_object' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/storage/models/aws/file.rb:119:in `save' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/fog-0.7.2/lib/fog/core/collection.rb:50:in `create' /users/nick/.rvm/gems/ruby-1.9.2-p180/bundler/gems/carrierwave-d2cb99103a4f/lib/carrierwave/storage/fog.rb:229:in `store' /users/nick/.rvm/gems/ruby-1.9.2-p180/bundler/gems/carrierwave-d2cb99103a4f/lib/carrierwave/storage/fog.rb:79:in `store!' /users/nick/.rvm/gems/ruby-1.9.2-p180/bundler/gems/carrierwave-d2cb99103a4f/lib/carrierwave/uploader/store.rb:59:in `block in store!' /users/nick/.rvm/gems/ruby-1.9.2-p180/bundler/gems/carrierwave-d2cb99103a4f/lib/carrierwave/uploader/callbacks.rb:17:in `with_callbacks' /users/nick/.rvm/gems/ruby-1.9.2-p180/bundler/gems/carrierwave-d2cb99103a4f/lib/carrierwave/uploader/store.rb:58:in `store!' /users/nick/.rvm/gems/ruby-1.9.2-p180/bundler/gems/carrierwave-d2cb99103a4f/lib/carrierwave/mount.rb:324:in `store!' /users/nick/.rvm/gems/ruby-1.9.2-p180/bundler/gems/carrierwave-d2cb99103a4f/lib/carrierwave/mount.rb:214:in `store_poster!' ... 3 levels... /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/validations.rb:43:in `save' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/attribute_methods/dirty.rb:21:in `save' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/transactions.rb:240:in `block (2 levels) in save' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/transactions.rb:207:in `transaction' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/transactions.rb:290:in `with_transaction_returning_status' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/transactions.rb:240:in `block in save' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/transactions.rb:251:in `rollback_active_record_state!' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.7/lib/active_record/transactions.rb:239:in `save' (irb):2 /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start' /users/nick/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>' script/rails:6:in `require'
i've tried debug manually , wonder whether issue ties in fact @content_type being set nil, although haven't been able deduce further that.
this s3 (or fog, don't have other providers) specific issue , project works fine when using :file storage. thoughts?
this problem bit me. solved putting in config/initializers/carrierwave.rb
:
s3_config = yaml.load_file(rails.root.join('config', 'amazon_s3.yml'))[rails.env] carrierwave.configure |config| config.storage = :s3 config.s3_access_policy = :public_read config.s3_access_key_id = s3_config['access_key_id'] config.s3_secret_access_key = s3_config['secret_access_key'] config.s3_bucket = s3_config['bucket'] end
and putting in config/amazon_s3.yml
:
development: access_key_id: xxxxxxxxxxxxxxxxxxxx secret_access_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx bucket: your-dev-bucket test: access_key_id: xxxxxxxxxxxxxxxxxxxx secret_access_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx bucket: your-test-bucket production: access_key_id: xxxxxxxxxxxxxxxxxxxx secret_access_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx bucket: your-prod-bucket
Comments
Post a Comment