Skip to content

DPL-214 [BUG] - Reduce exception noise - Labwhere - undefined method 'id' for nil:NilClass (C=?, V=2) #464

Open
@stevieing

Description

@stevieing

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:in metadata' /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:in encode' /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:in to_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:in block in publish' /var/www/labwhere/releases/20210824115818/app/messages/messages.rb:6:in each'
/var/www/labwhere/releases/20210824115818/app/messages/messages.rb:6:in publish' /var/www/labwhere/releases/20210824115818/app/models/labware.rb:85:in write_event'
/var/www/labwhere/releases/20210824115818/app/models/concerns/auditable.rb:28:in create_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:in block (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:in each_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:in transaction' /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:in push' /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:in block 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:in block (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:in block 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:in mon_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:in transaction' /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:in run_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:in block 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:in submit' /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:in send_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:in process_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:in run_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:in process_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:in block 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:in instrument' /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:in process_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:in process' /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:in dispatch' /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:in dispatch' /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:in block 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:in serve' /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:in call' /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:in call' /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:in call' /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:in context' /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:in call' /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:in run_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:in call' /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:in call_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:in call' /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:in call' /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:in call' /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:in call' /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:in call' /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:in call' /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:in with_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:in process_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:

  • data: {}

Look into what is causing this exception and discuss whether the fix is worthwhile with the team

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingvalue:2Value to the insitute is low

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions