Why would I get 2 different API responses from a staging and production environment in Rails 4.2?

518 Views Asked by At

So I'm querying an api in rails 4.2 with limit and offset parameters, and I get 2 different responses in staging and production environments - production errors out. Do you have any idea why it would work in one environment but not the other? Below are the logs. I'm using the rocket_pants gem for the api. How would I approach debugging something like this?

Staging response:

2015-01-31T01:42:41.650830+00:00 app[web.2]: Processing by Api::V1::KitesController#index as 
2015-01-31T01:42:41.650902+00:00 app[web.2]:   Parameters: {"limit"=>"10", "offset"=>"0", "version"=>"1"}
2015-01-31T01:42:42.970394+00:00 app[web.2]: Completed 200 OK in 1319ms

Production response:

015-01-31T01:45:30.290621+00:00 app[web.2]: Started GET "/1/kites?limit=10&offset=0" for 120.131.46.189 at 2015-01-31 01:45:30 +0000
2015-01-31T01:45:30.293135+00:00 app[web.2]:   Parameters: {"limit"=>"10", "offset"=>"0", "version"=>"1"}
2015-01-31T01:45:30.292819+00:00 app[web.2]: Processing by Api::V1::KitesController#index as 
2015-01-31T01:45:31.219974+00:00 heroku[router]: at=info method=GET path="/1/kites?limit=10&offset=0" host=kites.herokuapp.com request_id=3ca59d79-bf90-41e9-a828-ba8bd5d5b0c6 fwd="120.131.46.189" dyno=web.2 connect=1ms service=922ms status=500 bytes=581
2015-01-31T01:45:31.196390+00:00 app[web.2]: Exception occured: NoMethodError - undefined method `id' for #<Hash:0x007f03d6ec5320>
2015-01-31T01:45:31.196402+00:00 app[web.2]: Exception backtrace:
2015-01-31T01:45:31.196659+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/rocket_pants-1.9.2/lib/rocket_pants/controller/respondable.rb:129:in `respond_with_object_and_type'
2015-01-31T01:45:31.196699+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/rocket_pants-1.9.2/lib/rocket_pants/controller/respondable.rb:134:in `resource'
2015-01-31T01:45:31.196454+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/rocket_pants-1.9.2/lib/rocket_pants/controller/caching.rb:69:in `cache_key_for'
2015-01-31T01:45:31.196494+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/rocket_pants-1.9.2/lib/rocket_pants/controller/caching.rb:55:in `etag_for'
2015-01-31T01:45:31.196534+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/rocket_pants-1.9.2/lib/rocket_pants/controller/caching.rb:117:in `cache_response'
2015-01-31T01:45:31.196570+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/rocket_pants-1.9.2/lib/rocket_pants/controller/caching.rb:130:in `post_process_exposed_object'
2015-01-31T01:45:31.196773+00:00 app[web.2]: => /app/app/controllers/api/v1/clinical_trials_controller.rb:22:in `index'
2015-01-31T01:45:31.196737+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/rocket_pants-1.9.2/lib/rocket_pants/controller/respondable.rb:155:in `exposes'
2015-01-31T01:45:31.196808+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.0/lib/abstract_controller/base.rb:198:in `process_action'
2015-01-31T01:45:31.196842+00:00 app[web.2]: => /app/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.0/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
1

There are 1 best solutions below

2
Justin D. On

If by responses you mean what you see showing up in the log files, different environments have different default logging levels.

Here are two links that may be helpful: