Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `published?' for nil:NilClass @record.published? ^^^^^^^^^^^ #911

Open
aaronskiba opened this issue Sep 23, 2024 · 2 comments

Comments

@aaronskiba
Copy link
Collaborator

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


NoMethodError: undefined method `published?' for nil:NilClass

    @record.published?
           ^^^^^^^^^^^
  File "/var/www/sites/dmp/app/policies/public_page_policy.rb", line 22, in template_export?
  File "/var/www/sites/dmp/app/controllers/public_pages_controller.rb", line 33, in template_export
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal/basic_implicit_render.rb", line 6, in send_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb", line 228, in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal/rendering.rb", line 30, in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb", line 42, in block in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb", line 117, in block in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/turbo-rails-2.0.5/lib/turbo-rails.rb", line 24, in with_request_id
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/turbo-rails-2.0.5/app/controllers/concerns/turbo/request_id_tracking.rb", line 10, in turbo_tracking_request_id
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb", line 126, in block in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actiontext-6.1.7.8/lib/action_text/rendering.rb", line 20, in with_renderer
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actiontext-6.1.7.8/lib/action_text/engine.rb", line 59, in block (4 levels) in <class:Engine>
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb", line 126, in instance_exec
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb", line 126, in block in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb", line 137, in run_callbacks
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb", line 41, in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal/rescue.rb", line 22, in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb", line 34, in block in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb", line 203, in block in instrument
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/notifications/instrumenter.rb", line 24, in instrument
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb", line 203, in instrument
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb", line 33, in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal/params_wrapper.rb", line 249, in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/activerecord-6.1.7.8/lib/active_record/railties/controller_runtime.rb", line 27, in process_action
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb", line 165, in process
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionview-6.1.7.8/lib/action_view/rendering.rb", line 39, in process
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb", line 190, in dispatch
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb", line 254, in dispatch
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb", line 50, in dispatch
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb", line 33, in serve
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb", line 50, in block in serve
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb", line 32, in each
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb", line 32, in serve
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb", line 842, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 470, in call_app!
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth_openid_connect-0.7.1/lib/omniauth/strategies/openid_connect.rb", line 157, in other_phase
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 195, in call!
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 169, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 202, in call!
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 169, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 202, in call!
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/omniauth-2.1.2/lib/omniauth/strategy.rb", line 169, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/dragonfly-1.4.0/lib/dragonfly/middleware.rb", line 14, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/rack-attack-6.7.0/lib/rack/attack.rb", line 127, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/warden-1.2.9/lib/warden/manager.rb", line 36, in block in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/warden-1.2.9/lib/warden/manager.rb", line 34, in catch
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/warden-1.2.9/lib/warden/manager.rb", line 34, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/rack-2.2.9/lib/rack/tempfile_reaper.rb", line 15, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/rack-2.2.9/lib/rack/etag.rb", line 27, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/rack-2.2.9/lib/rack/conditional_get.rb", line 27, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/rack-2.2.9/lib/rack/head.rb", line 12, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/http/permissions_policy.rb", line 22, in call
  File "/var/www/sites/dmp/vendor/ruby/3.1.0/gems/actionpack-6.1.7.8/lib/action_dispatch/http/content_security_policy.rb", line 19, in call
  File "/var/www/
@aaronskiba
Copy link
Collaborator Author

The linked rollbar issue shows that the error resulted from the following GET call:
GET 'https://dmp-pgd.ca/template_export/wp-login.php

@aaronskiba
Copy link
Collaborator Author

The same error can be triggered with the following format when certain values are used for :id
GET /template_export/:id.pdf

In addition, say we have a valid :id value for GET /template_export/:id.pdf.
The following error occurs when executing GET /template_export/:id:

ActionController::UnknownFormat at /template_export/:id
ActionController::UnknownFormat

Maybe we should add handling to make allow GET /template_export/:id by setting .pdf as a default format?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant