Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

image_serializer.rb -- ArgumentError: bad argument (expected URI object or URI string) #52

Open
ghost opened this issue Oct 20, 2014 · 2 comments
Assignees

Comments

@ghost
Copy link

ghost commented Oct 20, 2014

using s3 for assets, add_host_prefix error

Starting pushing objects to Wombat
Pushed 1 Spree::Order to Wombat
rake aborted!
ArgumentError: bad argument (expected URI object or URI string)
/var/app/containerfiles/vendor_bundle/ruby/2.0/bundler/gems/spree_wombat-78d5ed2919da/app/serializers/spree/wombat/image_serializer.rb:31:in `add_host_prefix'
/var/app/containerfiles/vendor_bundle/ruby/2.0/bundler/gems/spree_wombat-78d5ed2919da/app/serializers/spree/wombat/image_serializer.rb:9:in `url'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:124:in `block in attributes'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:123:in `each'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:123:in `each_with_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:123:in `attributes'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:187:in `serializable_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/array_serializer.rb:41:in `block in serializable_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/activerecord-4.1.2/lib/active_record/relation/delegation.rb:46:in `map'
/var/app/current/vendor/bundle/ruby/2.0/gems/activerecord-4.1.2/lib/active_record/relation/delegation.rb:46:in `map'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/array_serializer.rb:40:in `serializable_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:173:in `serialize'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:136:in `block in associations'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:131:in `each'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:131:in `each_with_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:131:in `associations'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializer.rb:188:in `serializable_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/array_serializer.rb:41:in `block in serializable_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/activerecord-4.1.2/lib/active_record/relation/delegation.rb:46:in `map'
/var/app/current/vendor/bundle/ruby/2.0/gems/activerecord-4.1.2/lib/active_record/relation/delegation.rb:46:in `map'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/array_serializer.rb:40:in `serializable_object'
/var/app/current/vendor/bundle/ruby/2.0/gems/active_model_serializers-0.9.0.alpha1/lib/active_model/serializable.rb:9:in `as_json'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:90:in `jsonify'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `block in jsonify'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `each'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `map'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `jsonify'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:88:in `block in jsonify'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:88:in `map'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:88:in `jsonify'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `block in jsonify'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `each'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `map'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:86:in `jsonify'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:34:in `encode'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/json/encoding.rb:21:in `encode'
/var/app/current/vendor/bundle/ruby/2.0/gems/activesupport-4.1.2/lib/active_support/core_ext/object/json.rb:37:in `to_json_with_active_support_encoder'
/var/app/current/vendor/bundle/ruby/2.0/bundler/gems/spree_wombat-78d5ed2919da/lib/spree/wombat/client.rb:30:in `block in push_batches'
/var/app/current/vendor/bundle/ruby/2.0/gems/activerecord-4.1.2/lib/active_record/relation/batches.rb:125:in `find_in_batches'
/var/app/current/vendor/bundle/ruby/2.0/bundler/gems/spree_wombat-78d5ed2919da/lib/spree/wombat/client.rb:24:in `push_batches'
/var/app/containerfiles/vendor_bundle/ruby/2.0/bundler/gems/spree_wombat-78d5ed2919da/tasks/push_it.rake:13:in `block (3 levels) in <top (required)>'
/var/app/containerfiles/vendor_bundle/ruby/2.0/bundler/gems/spree_wombat-78d5ed2919da/tasks/push_it.rake:12:in `each'
/var/app/containerfiles/vendor_bundle/ruby/2.0/bundler/gems/spree_wombat-78d5ed2919da/tasks/push_it.rake:12:in `block (2 levels) in <top (required)>'
Tasks: TOP => wombat:push_it
@ghost
Copy link
Author

ghost commented Oct 20, 2014

i think it may have something to do with using a Proc for my asset_host, any ideas?

config.action_controller.asset_host = Proc.new do |source|
  if source =~ /\/pictures/
    nil
  else
    "//s3-#{ENV['FOG_REGION']}.amazonaws.com/#{ENV['FOG_DIRECTORY']}"
  end
end

@ghost
Copy link
Author

ghost commented Oct 20, 2014

additionally, the image_serializer being used by Spree::Wombat::ProductSerializer so if i'm not pushing Spree::Product objects then I won't receive the error.

@peterberkenbosch peterberkenbosch self-assigned this Oct 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant