portagenetwork / roadmap

Developed by the the Alliance in collaboration with University of Alberta, DMP Assistant a data management planning tool, forking the DMP Roadmap codebase
MIT License
6 stars 1 forks source link

NoMethodError on [GET] "/question_formats/rda_api_address" #736

Open aaronskiba opened 7 months ago

aaronskiba commented 7 months ago

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

Explanation [GET] "question_formats/rda_api_address" exists in config/routes.rb:

// config/routes.rb
# Question Formats controller, currently just the one action
  get 'question_formats/rda_api_address' => 'question_formats#rda_api_address'

Which corresponds to the following QuestionFormatsController method:

// app/controllers/question_formats_controller.rb
def rda_api_address
    render json: {
      url: QuestionFormat.rda_metadata.first.description
    }.to_json
  end

However, no db entries exist for QuestionFormat.rda_metadata:

$ rails c
Running via Spring preloader in process 1686600
Loading development environment (Rails 6.1.7.6)
irb: warn: can't alias context from irb_context.
2.7.6 :001 > QuestionFormat.rda_metadata.first.description
  QuestionFormat Load (0.3ms)  SELECT "question_formats".* FROM "question_formats" WHERE "question_formats"."formattype" = $1 ORDER BY "question_formats"."id" ASC LIMIT $2  [["formattype", 7], ["LIMIT", 1]]
Traceback (most recent call last):
        1: from (irb):1
NoMethodError (undefined method `description' for nil:NilClass)
2.7.6 :002 > QuestionFormat.rda_metadata.first
  QuestionFormat Load (1.8ms)  SELECT "question_formats".* FROM "question_formats" WHERE "question_formats"."formattype" = $1 ORDER BY "question_formats"."id" ASC LIMIT $2  [["formattype", 7], ["LIMIT", 1]]
 => nil 
2.7.6 :003 > 

View details in Rollbar: https://app.rollbar.com/a/ualbertalib/fix/item/dmp_assistant/439



NoMethodError: undefined method `description' for nil:NilClass
  File "/var/www/sites/dmp/app/controllers/question_formats_controller.rb", line 9, in rda_api_address
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb", line 6, in send_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb", line 228, in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb", line 30, in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb", line 42, in block in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb", line 117, in block in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actiontext-6.1.7.6/lib/action_text/rendering.rb", line 20, in with_renderer
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actiontext-6.1.7.6/lib/action_text/engine.rb", line 59, in block (4 levels) in <class:Engine>
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb", line 126, in instance_exec
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb", line 126, in block in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb", line 137, in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb", line 41, in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/rescue.rb", line 22, in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb", line 34, in block in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb", line 203, in block in instrument
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb", line 24, in instrument
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb", line 203, in instrument
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb", line 33, in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal/params_wrapper.rb", line 249, in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activerecord-6.1.7.6/lib/active_record/railties/controller_runtime.rb", line 27, in process_action
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb", line 165, in process
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionview-6.1.7.6/lib/action_view/rendering.rb", line 39, in process
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb", line 190, in dispatch
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb", line 254, in dispatch
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb", line 50, in dispatch
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb", line 33, in serve
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb", line 50, in block in serve
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb", line 32, in each
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb", line 32, in serve
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb", line 842, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 202, in call!
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 169, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 202, in call!
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 169, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/dragonfly-1.4.0/lib/dragonfly/middleware.rb", line 14, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb", line 36, in block in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb", line 34, in catch
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb", line 34, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rack-2.2.9/lib/rack/tempfile_reaper.rb", line 15, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rack-2.2.9/lib/rack/etag.rb", line 27, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rack-2.2.9/lib/rack/conditional_get.rb", line 27, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rack-2.2.9/lib/rack/head.rb", line 12, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/permissions_policy.rb", line 22, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/content_security_policy.rb", line 19, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rack-2.2.9/lib/rack/session/abstract/id.rb", line 266, in context
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rack-2.2.9/lib/rack/session/abstract/id.rb", line 260, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/cookies.rb", line 697, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb", line 27, in block in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb", line 98, in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb", line 26, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/actionable_exceptions.rb", line 18, in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rollbar-3.5.1/lib/rollbar/middleware/rails/rollbar.rb", line 25, in block in call
  File "/var/www/sites/dmp/vendor/ruby/2.7.0/gems/rollbar-3.5.1/lib/rollbar.rb", line 145, in scoped
  File "/var/www/sites/d
lagoan commented 7 months ago

@aaronskiba will look more into this behaviour on upstream

aaronskiba commented 6 months ago

Upstream behaviour: Screenshot from 2024-05-14 16-15-39