API find(:all): ActiveResource::Base.collect! dying on malformed data in error

Laurens Dorsey's Avatar

Laurens Dorsey

20 Feb, 2012 03:54 PM via web

Any help working around this error would be appreciated.

An api script that used to work fine (really) has started to crash, apparently while fetching malformed param data in one of the errors. (I don't know whether this data has been handled without complaint in the past.) I have tried swapping active resource 3.0.7 with 2.3.5.

Among the errors for a project is a POST request having these parameters (as shown in the AB ui):

{"product_id"=>"XXX",
 "overall_condition"=>"abc",
 "action"=>"show",
 "calculator_answers"=>
  {"24"=>"53",
   "25"=>"55",
   "26"=>"57",
   "27"=>"59",
   "29"=>"63",
   "30"=>{"\"Xx<XaXaXXaXaX>xX"=>"65"}},
 "used_condition"=>"DEF",
 "controller"=>"calculations"}

This is malformed data (fwiw). The api call find(:all) is dying with the following error, which I have not seen before:

/gems/activeresource-3.0.7/lib/active_resource/base.rb:1130:in `const_defined?': wrong constant name 30 (NameError)
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1130:in `find_or_create_resource_for'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1031:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `each'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:723:in `initialize'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1032:in `new'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1032:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `each'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:723:in `initialize'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1032:in `new'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1032:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `each'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:723:in `initialize'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1032:in `new'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1032:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `each'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:1018:in `load'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:723:in `initialize'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:666:in `new'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:666:in `instantiate_record'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:662:in `instantiate_collection'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:662:in `collect!'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:662:in `instantiate_collection'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:639:in `find_every'
  from /gems/activeresource-3.0.7/lib/active_resource/base.rb:582:in `find'
  from airbrake.rb:20:in `find'
  from airbrake.rb:47
  1. Support Staff 2 Posted by airbrakeben on 21 Feb, 2012 07:22 PM

    airbrakeben's Avatar

    HI Laurens,

    We pushed a bug fix to our API recently. This could have had a knock on affect. I'll let our devs know.

  2. 3 Posted by Laurens Dorsey on 21 Feb, 2012 08:44 PM

    Laurens Dorsey's Avatar

    Thanks muchly, Ben. Let me know if I can provide any additional info.

    Cheers.

  3. 4 Posted by Laurens Dorsey on 29 Feb, 2012 02:51 PM

    Laurens Dorsey's Avatar

    Howdy --

    Given the error using the ruby api, and seeing that the xml api is richer than the ruby (allowing drilldown into additional info via additional xml fetches), I thought I would give the xml a whirl instead.

    But I see errors there, too; similar if not identical. Calling:
    https://secondrotation.airbrake.io/projects/9058/errors.xml?TOKEN=1234567etc

    I receive the attached page, showing the error:
    This page contains the following errors:

    error on line 1884 at column 12: StartTag: invalid element name
    Below is a rendering of the page up to the first error.

    Help?

    Cheers.

  4. Support Staff 5 Posted by airbrakeben on 05 Mar, 2012 11:59 PM

    airbrakeben's Avatar

    Hi Laurens.. I see your ticket is still open. I'll chase up with the dev who's working on this.

  5. 6 Posted by Laurens Dorsey on 30 Mar, 2012 05:11 PM

    Laurens Dorsey's Avatar

    Howdy, Ben -- Just wanted to let you know that I got back to my api script this week, and everything seems to be back to normal. Thanks for your help.

    Tgif.

  6. Support Staff 7 Posted by Stuart Chaney on 30 Mar, 2012 10:03 PM

    Stuart Chaney's Avatar

    :)

  7. Stuart Chaney closed this discussion on 30 Mar, 2012 10:03 PM.

Comments are currently closed for this discussion. You can start a new one.