Uploaded image for project: 'Couchbase Ruby client library'
  1. Couchbase Ruby client library
  2. RCBC-95

Server's helpful error about map.js errors gets replaced by a generic http 400 happened while uploading design document

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0.z.beta4
    • Fix Version/s: 1.2.0
    • Component/s: library
    • Security Level: Public
    • Labels:
      None
    • Environment:
      Mountain Lion

      Description

      Repro:

      Create a new model, use the genrator to create a view
      add the view line to the model
      start the app (rails console)

      The default map.js with all the comments in and examples will cause the error already.

      /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/couchbase-1.2.0.z.beta4/lib/couchbase/bucket.rb:165:in `continue': failed to execute HTTP request (key="_design/clocking", status="400" (Bad Request), error=0x00) (Couchbase::Error::HTTP)
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/couchbase-1.2.0.z.beta4/lib/couchbase/bucket.rb:165:in `save_design_doc'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/couchbase-model-0.5.0/lib/couchbase/model.rb:260:in `ensure_design_document!'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/couchbase-model-0.5.0/lib/couchbase/railtie.rb:120:in `block (3 levels) in <class:Railtie>'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/couchbase-model-0.5.0/lib/couchbase/railtie.rb:119:in `each'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/couchbase-model-0.5.0/lib/couchbase/railtie.rb:119:in `block (2 levels) in <class:Railtie>'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:418:in `run3328634455356380055prepare3132553472985099836_callbacks'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:405:in `__run_callback'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/activesupport-3.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/actionpack-3.2.9/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/actionpack-3.2.9/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
      from /Users/piotr/Work/git/ph_time/config/environment.rb:5:in `<top (required)>'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/application.rb:103:in `require'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/application.rb:103:in `require_environment!'
      from /Users/piotr/.rvm/gems/ruby-1.9.3-p327@time/gems/railties-3.2.9/lib/rails/commands.rb:40:in `<top (required)>'
      from script/rails:6:in `require'
      from script/rails:6:in `<main>'

      Now after a bit of tinkering .. I just added an else to the if block_given? in there .. to reveal the error ..
      if block_given?
      if res.success? && val['error']
      res.error = Error::View.new("save_design_doc", val['error'])
      end
      yield(res)
      else
      unless res.success?
      if val['error'] && val['reason']
      raise Couchbase::Error::View.new(val['error'], val['reason'])
      end
      end
      end

      And that returned a much more civil error:

      SERVER: invalid_design_document: Syntax error in the map function of the view `by_date': SyntaxError: Unexpected end of input (Couchbase::Error::View)

      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            avsej Sergey Avseyev
            Reporter:
            piotrb Piotr Banasik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes