Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Type of 'multipart/mixed' causes Ripple::Document.find to raise errors #315

Open
weiser opened this issue Mar 21, 2013 · 2 comments

Comments

@weiser
Copy link

weiser commented Mar 21, 2013

Description: I have a Document which does not contain any conflicts, but has a HTTP Content-Type of 'multipart/mixed'. Because of this, I get "NotImplementedError: No serializer has been registered for content type "multipart/mixed" " errors.

Settings:

GIT
  remote: git://github.com/basho/ripple.git
  revision: f866ddd5e2b0a11bb11bd29683f4f41f5c1bca22 # also tested on 913806aa2942db5a3b61d1432d2c9be200338f50
  specs:
    ripple (1.0.0.beta2)
      activemodel (>= 3.0.0, < 3.3.0)
      activesupport (>= 3.0.0, < 3.3.0)
      riak-client (~> 1.0.0)
      tzinfo

Precondition:

  1. I have a riak document which returns the following (removed identifying info) curl (-v) value:
seomoz@silo-app1:/var/www/vhosts/silo/current$ curl  riakhost:8098/riak/subscriptions/subscription_id
* About to connect() to riakhost port 8098 (#0)
*   Trying xx.yy.zz.kk... connected
* Connected to riakhost (xx.yy.zz.kk) port 8098 (#0)
> GET /riak/subscriptions/subscription_id HTTP/1.1
> Authorization: Basic YWRtaW46cm85cnRlNnZlNnJpcg==
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: riakhost:8098
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Riak-Vclock: a85hYGDgymDKBVIcs/tdtwWou13OYEpkymNluHJqz0k+qNRuWcu/AWqLD0GleDgOwKVetCdVBqgtigJK8QGlYliPoeravuYLUIoRZKCWzikUXUEie4BS3ECpjt2RcKl8xZVWASH/TYFSQkCp/5Wr4VL+m68WBkScdgJKGQKlprWuhUul1zFoBNrls0LtEpfZDpfKZNqzNtDq9ESgFCtQ6pcSQqpDZ9vJQDstEagusFQWAA==
< X-Riak-Meta-Body-Checksum: 61e1b263f7200f8530dc438fb560e73a
< Vary: Accept-Encoding
< Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
< Link: </riak/subscriptions>; rel="up"
< Last-Modified: Fri, 15 Mar 2013 04:43:38 GMT
< ETag: "HFtGR9Dq6LRFNONqVhN1H"
< Date: Thu, 21 Mar 2013 18:58:14 GMT
< Content-Type: multipart/mixed
< Content-Length: 5191
<
{"schema_version":3,"dates_scheduled":["2011-10-13","2011-10-20","2011-10-27","2011-11-03","2011-11-10","2011-11-17"],"dates_finalized":["2011-10-13","2011-10-20","2011-10-27"]}
* Connection #0 to host riakhost left intact
* Closing connection #0

Repro steps:

Subscription.find('subscription_id')

Actual Results:

irb(main):001:0> sub = Subscription.find('subscription_id')
NotImplementedError: No serializer has been registered for content type "multipart/mixed"
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/gems/riak-client-1.0.5/lib/riak/serializers.rb:26:in `block in serializer_for'
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/gems/riak-client-1.0.5/lib/riak/serializers.rb:25:in `fetch'
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/gems/riak-client-1.0.5/lib/riak/serializers.rb:25:in `serializer_for'
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/gems/riak-client-1.0.5/lib/riak/serializers.rb:19:in `deserialize'
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/gems/riak-client-1.0.5/lib/riak/robject.rb:253:in `deserialize'
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/gems/riak-client-1.0.5/lib/riak/robject.rb:143:in `data'
    from /var/www/vhosts/silo/releases/20130316011131/lib/concerns/versionable.rb:42:in `instantiate'
    from /var/www/vhosts/silo/releases/20130316011131/lib/models/subscription.rb:383:in `instantiate'
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/bundler/gems/ripple-f866ddd5e2b0/lib/ripple/document/finders.rb:113:in `find_one'
    from /var/www/vhosts/silo/shared/bundle/ruby/1.9.1/bundler/gems/ripple-f866ddd5e2b0/lib/ripple/document/finders.rb:55:in `find'
    from (irb):1
    from /usr/local/bin/irb:12:in `<main>'

Expected Results: the document loads correctly.

Work Around?:
I have found a work around:

Riak::Serializers['multipart/mixed'] = Riak::Serializers::ApplicationJSON
sub = Subscription.find('subscription_id')

This loads the document so I can then save it.

I'm looking into this more, but I fiugured I'd file a bug.

@seancribbs
Copy link
Contributor

Does your application model override Ripple::Document#update_robject? If so, be sure to either call super first, or set the content_type properly. Aside from saving back objects that were once in conflict with the multipart/mixed content type, I don't see how this could occur without something else interfering.

@weiser
Copy link
Author

weiser commented Mar 21, 2013

We are not overriding Ripple::Document#update_robject.

I'll update this ticket if I find anything else out.

On Thu, Mar 21, 2013 at 12:32 PM, Sean Cribbs [email protected]:

Does your application model override Ripple::Document#update_robject? If
so, be sure to either call super first, or set the content_type properly.
Aside from saving back objects that were once in conflict with the
multipart/mixed content type, I don't see how this could occur without
something else interfering.


Reply to this email directly or view it on GitHubhttps://github.com//issues/315#issuecomment-15260370
.

Thanks,
Weiser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants