Describe the bug
This seems to be a bug that is not causing any user issues but it raises an exception email several times a day so needs to be investigated.
A NoMethodError occurred in background at 2022-01-04 10:46:41 +0000 :
undefined method id' for nil:NilClass /var/www/labwhere/releases/20210824115818/app/models/event.rb:29:infor_old_audit?'
Describe the bug This seems to be a bug that is not causing any user issues but it raises an exception email several times a day so needs to be investigated.
A NoMethodError occurred in background at 2022-01-04 10:46:41 +0000 :
undefined method
id' for nil:NilClass /var/www/labwhere/releases/20210824115818/app/models/event.rb:29:in
for_old_audit?'Backtrace:
/var/www/labwhere/releases/20210824115818/app/models/event.rb:29:in
for_old_audit?' /var/www/labwhere/releases/20210824115818/app/models/event.rb:67:in
coordinate' /var/www/labwhere/releases/20210824115818/app/models/event.rb:143:inmetadata' /var/www/labwhere/releases/20210824115818/app/models/event.rb:83:in
as_json' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/json/encoding.rb:35:inencode' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/json/encoding.rb:22:in
encode' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/core_ext/object/json.rb:41:into_json' /var/www/labwhere/releases/20210824115818/app/messages/messages/message.rb:13:in
payload' /var/www/labwhere/releases/20210824115818/app/messages/messages/broker.rb:90:in_publish' /var/www/labwhere/releases/20210824115818/app/messages/messages/broker.rb:80:in
publish' /var/www/labwhere/releases/20210824115818/app/messages/messages.rb:7:inblock in publish' /var/www/labwhere/releases/20210824115818/app/messages/messages.rb:6:in
each' /var/www/labwhere/releases/20210824115818/app/messages/messages.rb:6:inpublish' /var/www/labwhere/releases/20210824115818/app/models/labware.rb:85:in
write_event' /var/www/labwhere/releases/20210824115818/app/models/concerns/auditable.rb:28:increate_audit_shared' /var/www/labwhere/releases/20210824115818/app/models/concerns/auditable.rb:18:in
create_audit' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:24:inblock (2 levels) in push' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:20:in
each' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:20:ineach_with_index' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:20:in
block in push' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:265:intransaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:212:in
transaction' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/base.rb:19:inpush' /var/www/labwhere/releases/20210824115818/app/models/labware_collection/unordered_location.rb:6:in
push' /var/www/labwhere/releases/20210824115818/app/forms/scan_form.rb:15:inblock in <class:ScanForm>' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:111:in
instance_eval' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:111:inblock (2 levels) in after_validate' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:177:in
block in run_transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:267:inblock in transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:239:in
block in within_new_transaction' /home/ubuntu/.rbenv/versions/2.5.8/lib/ruby/2.5.0/monitor.rb:235:inmon_synchronize' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:236:in
within_new_transaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:267:intransaction' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:212:in
transaction' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:176:inrun_transaction' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:110:in
block in after_validate' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:136:inblock in submit' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:98:in
run_callbacks' /var/www/labwhere/releases/20210824115818/app/form_object/form_object.rb:134:insubmit' /var/www/labwhere/releases/20210824115818/app/controllers/scans_controller.rb:11:in
create' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/basic_implicit_render.rb:6:insend_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/base.rb:194:in
process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/rendering.rb:30:inprocess_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/callbacks.rb:42:in
block in process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:132:inrun_callbacks' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/callbacks.rb:41:in
process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/rescue.rb:22:inprocess_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/instrumentation.rb:34:in
block in process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/notifications.rb:168:inblock in instrument' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/notifications/instrumenter.rb:23:in
instrument' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/notifications.rb:168:ininstrument' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/instrumentation.rb:32:in
process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal/params_wrapper.rb:256:inprocess_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.6/lib/active_record/railties/controller_runtime.rb:24:in
process_action' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/abstract_controller/base.rb:134:inprocess' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionview-5.2.6/lib/action_view/rendering.rb:32:in
process' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal.rb:191:indispatch' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_controller/metal.rb:252:in
dispatch' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:52:indispatch' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:34:in
serve' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:52:inblock in serve' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:35:in
each' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/journey/router.rb:35:inserve' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:840:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/exception_notification-4.4.3/lib/exception_notification/rack.rb:49:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/tempfile_reaper.rb:15:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/etag.rb:25:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/conditional_get.rb:38:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/head.rb:12:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/http/content_security_policy.rb:18:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:259:incontext' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/session/abstract/id.rb:253:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/cookies.rb:670:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/callbacks.rb:28:in
block in call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/callbacks.rb:98:inrun_callbacks' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/callbacks.rb:26:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:61:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/show_exceptions.rb:33:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.6/lib/rails/rack/logger.rb:38:incall_app' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.6/lib/rails/rack/logger.rb:28:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/remote_ip.rb:81:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/request_id.rb:27:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/method_override.rb:22:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/runtime.rb:22:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:29:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/executor.rb:14:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/static.rb:127:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-2.0.9/lib/rack/sendfile.rb:111:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/railties-5.2.6/lib/rails/engine.rb:524:in
call' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/configuration.rb:249:incall' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/request.rb:77:in
block in handle_request' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/thread_pool.rb:340:inwith_force_shutdown' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/request.rb:76:in
handle_request' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/server.rb:440:inprocess_client' /var/www/labwhere/shared/vendor/bundle/ruby/2.5.0/gems/puma-5.4.0/lib/puma/thread_pool.rb:147:in
block in spawn_thread'Data:
Look into what is causing this exception and discuss whether the fix is worthwhile with the team