#689 open
Matt Mower

Lighthouse API causing exceptions!!!!

Reported by Matt Mower | April 15th, 2008 @ 03:51 AM

This morning I am seeing exceptions being thrown from code that uses the LH API to report issues. Here is a sample (they are all the same):

A ArgumentError occurred in found_videos#create:

expected an attributes Hash, got "resolved"

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:750:in `load'

-------------------------------

Request:

-------------------------------

  • URL : http://reeplay.it/ident_requests...
  • IP address: 88.149.159.134
  • Parameters: {"found_video"=>{"keyframe_height"=>"", "keyframe_width"=>"", "keyframe_url"=>"", "backend_id"=>""}, "action"=>"create", "ident_request_id"=>"993", "controller"=>"found_videos"}
  • Rails root: /data/comi/releases/20080414101800

-------------------------------

Session:

-------------------------------

  • session id: "8a64a80d23ec04d931478106a90f5dc1"
  • data: {:user=>1, "flash"=>{}}

-------------------------------

Environment:

-------------------------------

  • CONTENT_LENGTH : 153
  • CONTENT_TYPE : application/x-www-form-urlencoded
  • GATEWAY_INTERFACE : CGI/1.2
  • HTTP_ACCEPT : text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
  • HTTP_AUTHORIZATION : Basic bWVkaWFfc2VydmVyOldvMG50dXJm
  • HTTP_CACHE_CONTROL : no-cache
  • HTTP_CONNECTION : close
  • HTTP_CONTENT_LENGTH : 153
  • HTTP_CONTENT_TYPE : application/x-www-form-urlencoded
  • HTTP_HOST : reeplay.it
  • HTTP_PRAGMA : no-cache
  • HTTP_USER_AGENT : Java/1.5.0_14
  • HTTP_VERSION : HTTP/1.0
  • HTTP_X_FORWARDED_FOR: 88.149.159.134
  • HTTP_X_REAL_IP : 88.149.159.134
  • PATH_INFO : /ident_requests/993/found_videos
  • RAW_POST_DATA : [FILTERED]
  • REMOTE_ADDR : 127.0.0.1
  • REQUEST_METHOD : POST
  • REQUEST_PATH : /ident_requests/993/found_videos
  • REQUEST_URI : /ident_requests/993/found_videos
  • SCRIPT_NAME : /
  • SERVER_NAME : reeplay.it
  • SERVER_PORT : 80
  • SERVER_PROTOCOL : HTTP/1.1
  • SERVER_SOFTWARE : Mongrel 1.1.1
  • Process: 16833
  • Server : ey01-s00465

-------------------------------

Backtrace:

-------------------------------

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:750:in `load'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:521:in `initialize'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:757:in `new'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:757:in `load'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:757:in `map'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:757:in `load'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:752:in `each'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:752:in `load'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:521:in `initialize'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:760:in `new'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:760:in `load'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:752:in `each'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:752:in `load'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:521:in `initialize'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:469:in `new'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:469:in `instantiate_record'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:461:in `find_single'

[RAILS_ROOT]/vendor/rails/activeresource/lib/active_resource/base.rb:388:in `find'

[RAILS_ROOT]/lib/reeplay/base.rb:42:in `video_project'

[RAILS_ROOT]/app/models/ident_request.rb:29:in `report_to_lighthouse'

[RAILS_ROOT]/app/models/ident_request.rb:13:in `close'

My report_to_lighthouse function:

idef report_to_lighthouse( reason )

begin

if Reeplay::Base.lighthouse_enabled

if found_videos.size == 0

ticket = Lighthouse::Ticket.new(

:project_id => Lighthouse.video_project.id,

:title => reason,

:body => <

Url: #{self.url}

Title: #{self.title}

Key: #{self.key}

IdentRequest: #{self.id}

BODY

)

ticket.save

end

end

rescue => error

end

end

This was working as of yesterday. I notice this morning changes to the UI and wonder if these two things can be connected?

Comments and changes to this ticket

  • Martin Pilkington

    Martin Pilkington April 15th, 2008 @ 07:10 AM

    projects.xml also seems to be broken. Tickets, memberships, milestones and bins all seem to work fine for getting data, not sure about posting.

  • Matt Mower

    Matt Mower April 15th, 2008 @ 11:33 AM

    • → Title changed from “Lighthouse API not working the same” to “Lighthouse API causing exceptions!”

    Extra hyperbole in the title

  • rick

    rick April 15th, 2008 @ 02:15 PM

    • → State changed from “new” to “resolved”
    • → Title changed from “Lighthouse API causing exceptions!” to “Lighthouse API causing exceptions!!!!”

    The API is fine, I was just returning some wonky XML that ActiveResource was choking on. To keep things simple, here's what the XML looks like:

    <project>
       <!-- SNIP -->
      <open-states>new/f17  # You can add comments here
    open/f17 # if you want to.</open-states>
      <closed-states>resolved/333 # You can customize colors
    hold/EB0     # with 3 or 6 character hex codes
    invalid/A30  # 'A30' expands to 'AA3300'</closed-states>
      <open-states-list>new,open</open-states-list>
      <closed-states-list>resolved,hold,invalid</closed-states-list>
    </project>
    

    The open-states and closed-states elements don't return the raw YAML hash anymore. Instead, they return the exact text entered in the 'edit project' form. I also provide 'open-states-list' and 'closed-states-list' elements with comma separated states that have all been parsed already.

  • remi

    remi September 26th, 2008 @ 02:23 PM

    • → Tag changed from “” to “"@high" api error”

    This just started happening for me today. I'm using the trunk of the lighthouse-api @ http://github.com/Caged/lighthou.... Projects.find(:all) worked yesterday, but not today (and there haven't been any relevant changes to lighthouse-api).

    I now get:

    Lighthouse::Project.find(:all) ArgumentError: expected an attributes Hash, got "resolved,hold,invalid"

    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:891:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:642:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:898:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:898:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:898:in `map'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:898:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:893:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:893:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:642:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:590:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:590:in `instantiate_record'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:586:in `instantiate_collection'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:586:in `collect!'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:586:in `instantiate_collection'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:563:in `find_every'
    from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.1.1/lib/active_resource/base.rb:507:in `find'
    from (irb):4>>
    
    

    If this bug is open again ... please fix it :) If I need to update something on my end to keep AR from choking, lemme know. Thanks!

  • rick

    rick September 26th, 2008 @ 04:05 PM

    • → State changed from “resolved” to “open”

    The API code was touched, but the output values haven't changed. Here's what it looks like right now:

    
    <project>
      <!-- SNIP -->
      <open-states-list>new,open</open-states-list>
      <closed-states-list>resolved,hold,invalid,duplicate,someday-maybe</closed-states-list>
      <open-states>new/f17  # You can add comments here
    open/aaa # if you want to.</open-states>
      <closed-states>resolved/6A0 # You can customize colors
    hold/EB0     # with 3 or 6 character hex codes
    invalid/A30  # 'A30' expands to 'AA3300'
    duplicate/f51 # Duplicate ticket
    someday-maybe/887755 # Someday</closed-states>
    </project>
    

    Though, I do see one project with <open-states-list> shown twice. That would cause the error...

  • rick

    rick September 26th, 2008 @ 04:09 PM

    Hmm, of the two projects listed in ActiveReload, only one of them has dual attributes. And it doesn't happen when you get just the details on that one project. Strange.

  • rick

    rick September 26th, 2008 @ 04:22 PM

    Try it now. I added some code to ensure the same properties weren't being added multiple times.

    If you want to know what happened:

    I have some code to set default options for object serialization so that certain model attributes aren't sent out as xml or json:

    
    class Project
      def to_xml(options = {})
        super(formatted_options(options))
      end
    
      def to_json(options = {})
        super(formatted_options(options))
      end
    
      def formatted_options(options = {})
        (options[:methods] ||= []) << :open_states_list
        options
      end
    end
    

    When outputting an array of projects, #formatted_objects was being called multiple times, and adding :open_states_list each time. I suppose ActiveResource treats multiple elements as a hash.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Using Lighthouse to track Lighthouse.

Shared Ticket Bins

People watching this ticket

Tags