NoMethodError: undefined method `public_token' for nil (NoMethodError)

Sentry Issue: EVALMEE-3H8

NoMethodError: undefined method `public_token' for nil (NoMethodError)

        link(:exam_session) { |r, obj| r.api_public_v2_exam_exam_session_url(obj.quiz.uuid, obj.session.public_token) }
                                                                                                       ^^^^^^^^^^^^^
    from app/blueprints/api/public/v2/exam_attempt_blueprint.rb:42:in 'block in <class:ExamAttemptBlueprint>'
    from app/blueprints/api/public/v2/base_blueprint.rb:32:in 'block (2 levels) in has_links'
    from app/blueprints/api/public/v2/base_blueprint.rb:31:in 'each'
    from app/blueprints/api/public/v2/base_blueprint.rb:31:in 'each_with_object'
    from app/blueprints/api/public/v2/base_blueprint.rb:31:in 'block in has_links'
    from blueprinter/extractors/block_extractor.rb:9:in 'extract'
    from blueprinter/extractors/auto_extractor.rb:23:in 'extract'
    from blueprinter/field.rb:17:in 'extract'
    from blueprinter/helpers/base_helpers.rb:64:in 'block in object_to_hash'
    from blueprinter/helpers/base_helpers.rb:61:in 'each'
    from blueprinter/helpers/base_helpers.rb:61:in 'each_with_object'
    from blueprinter/helpers/base_helpers.rb:61:in 'object_to_hash'
    from blueprinter/helpers/base_helpers.rb:38:in 'block in prepare_data'
    from blueprinter/helpers/base_helpers.rb:37:in 'map'
    from blueprinter/helpers/base_helpers.rb:37:in 'prepare_data'
    from blueprinter/base.rb:256:in 'prepare'
    from blueprinter/helpers/base_helpers.rb:22:in 'prepare_for_render'
    from blueprinter/base.rb:217:in 'render_as_hash'
    from app/models/public/paginated_collection.rb:71:in 'render_as_hash'
    from blueprinter/extractors/public_send_extractor.rb:9:in 'public_send'
    from blueprinter/extractors/public_send_extractor.rb:9:in 'extract'
    from blueprinter/extractors/auto_extractor.rb:23:in 'extract'
    from blueprinter/field.rb:17:in 'extract'
    from blueprinter/helpers/base_helpers.rb:64:in 'block in object_to_hash'
    from blueprinter/helpers/base_helpers.rb:61:in 'each'
    from blueprinter/helpers/base_helpers.rb:61:in 'each_with_object'
    from blueprinter/helpers/base_helpers.rb:61:in 'object_to_hash'
    from blueprinter/helpers/base_helpers.rb:43:in 'prepare_data'
    from blueprinter/base.rb:256:in 'prepare'
    from blueprinter/extractors/association_extractor.rb:24:in 'extract'
    from blueprinter/field.rb:17:in 'extract'
    from blueprinter/helpers/base_helpers.rb:64:in 'block in object_to_hash'
    from blueprinter/helpers/base_helpers.rb:61:in 'each'
    from blueprinter/helpers/base_helpers.rb:61:in 'each_with_object'
    from blueprinter/helpers/base_helpers.rb:61:in 'object_to_hash'
    from blueprinter/helpers/base_helpers.rb:38:in 'block in prepare_data'
    from active_record/relation/delegation.rb:100:in 'each'
    from active_record/relation/delegation.rb:100:in 'each'
    from blueprinter/helpers/base_helpers.rb:37:in 'map'
    from blueprinter/helpers/base_helpers.rb:37:in 'prepare_data'
    from blueprinter/base.rb:256:in 'prepare'
    from blueprinter/helpers/base_helpers.rb:22:in 'prepare_for_render'
    from blueprinter/base.rb:217:in 'render_as_hash'
    from app/models/public/paginated_collection.rb:71:in 'render_as_hash'
    from blueprinter/extractors/public_send_extractor.rb:9:in 'public_send'
    from blueprinter/extractors/public_send_extractor.rb:9:in 'extract'
    from blueprinter/extractors/auto_extractor.rb:23:in 'extract'
    from blueprinter/field.rb:17:in 'extract'
    from blueprinter/helpers/base_helpers.rb:64:in 'block in object_to_hash'
    from blueprinter/helpers/base_helpers.rb:61:in 'each'
    from blueprinter/helpers/base_helpers.rb:61:in 'each_with_object'
    from blueprinter/helpers/base_helpers.rb:61:in 'object_to_hash'
    from blueprinter/helpers/base_helpers.rb:43:in 'prepare_data'
    from blueprinter/base.rb:256:in 'prepare'
    from blueprinter/helpers/base_helpers.rb:22:in 'prepare_for_render'
    from blueprinter/base.rb:192:in 'render'
    from app/controllers/api/public/v2/base_controller.rb:98:in 'render_index'
    from app/controllers/api/public/v2/exam_results_controller.rb:41:in 'index'
    from action_controller/metal/basic_implicit_render.rb:6:in 'send_action'
    from abstract_controller/base.rb:224:in 'process_action'
    from scout_apm/instruments/action_controller_rails_3_rails4.rb:103:in 'process_action'
    from action_controller/metal/rendering.rb:165:in 'process_action'
    from abstract_controller/callbacks.rb:259:in 'block in process_action'
    from active_support/callbacks.rb:121:in 'block in run_callbacks'
    from app/services/audit/current_context.rb:167:in 'with_auditable'
    from app/controllers/concerns/api/public/audit_context.rb:35:in 'block (2 levels) in with_audit_context'
    from app/services/audit/current_context.rb:251:in 'with_intermediary'
    from app/controllers/concerns/api/public/audit_context.rb:34:in 'block in with_audit_context'
    from app/services/audit/current_context.rb:206:in 'with_actor'
    from app/controllers/concerns/api/public/audit_context.rb:33:in 'with_audit_context'
    from active_support/callbacks.rb:130:in 'block in run_callbacks'
    from action_text/rendering.rb:23:in 'with_renderer'
    from action_text/engine.rb:69:in 'block (4 levels) in <class:Engine>'
    from active_support/callbacks.rb:130:in 'instance_exec'
    from active_support/callbacks.rb:130:in 'block in run_callbacks'
    from ahoy/controller.rb:50:in 'set_ahoy_request_store'
    from active_support/callbacks.rb:130:in 'block in run_callbacks'
    from sentry/rails/controller_transaction.rb:21:in 'block in sentry_around_action'
    from sentry/hub.rb:115:in 'block in with_child_span'
    from sentry/span.rb:237:in 'with_child_span'
    from sentry/hub.rb:113:in 'with_child_span'
    from sentry-ruby.rb:503:in 'with_child_span'
    from sentry/rails/controller_transaction.rb:18:in 'sentry_around_action'
    from active_support/callbacks.rb:130:in 'block in run_callbacks'
    from active_support/callbacks.rb:141:in 'run_callbacks'
    from abstract_controller/callbacks.rb:258:in 'process_action'
    from action_controller/metal/rescue.rb:25:in 'process_action'
    from action_controller/metal/instrumentation.rb:74:in 'block in process_action'
    from active_support/notifications.rb:206:in 'block in instrument'
    from active_support/notifications/instrumenter.rb:58:in 'instrument'
    from sentry/rails/tracing.rb:56:in 'instrument'
    from active_support/notifications.rb:206:in 'instrument'
    from action_controller/metal/instrumentation.rb:73:in 'process_action'
    from action_controller/metal/params_wrapper.rb:261:in 'process_action'
    from rescue_registry/controller.rb:24:in 'process_action'
    from active_record/railties/controller_runtime.rb:32:in 'process_action'
    from scout_apm/instruments/action_controller_rails_3_rails4.rb:120:in 'process_action'
    from abstract_controller/base.rb:160:in 'process'
    from action_view/rendering.rb:40:in 'process'
    from action_controller/metal.rb:227:in 'dispatch'
    from action_controller/metal.rb:309:in 'dispatch'
    from action_dispatch/routing/route_set.rb:49:in 'dispatch'
    from action_dispatch/routing/route_set.rb:32:in 'serve'
    from action_dispatch/journey/router.rb:51:in 'block in serve'
    from action_dispatch/journey/router.rb:131:in 'block in find_routes'
    from action_dispatch/journey/router.rb:124:in 'each'
    from action_dispatch/journey/router.rb:124:in 'find_routes'
    from action_dispatch/journey/router.rb:32:in 'serve'
    from action_dispatch/routing/route_set.rb:882:in 'call'
    from scout_apm/instruments/rails_router.rb:29:in 'call_with_scout_instruments'
    from omniauth/strategy.rb:192:in 'call!'
    from omniauth/strategy.rb:169:in 'call'
    from omniauth/strategy.rb:192:in 'call!'
    from omniauth/strategy.rb:169:in 'call'
    from omniauth/strategy.rb:192:in 'call!'
    from omniauth/strategy.rb:169:in 'call'
    from omniauth/strategy.rb:192:in 'call!'
    from omniauth/strategy.rb:169:in 'call'
    from omniauth/strategy.rb:192:in 'call!'
    from omniauth/strategy.rb:169:in 'call'
    from omniauth/strategy.rb:420:in 'call_app!'
    from omniauth/strategies/openid_connect.rb:155:in 'other_phase'
    from omniauth/strategy.rb:190:in 'call!'
    from omniauth/strategy.rb:169:in 'call'
    from omniauth/strategy.rb:420:in 'call_app!'
    from omniauth/strategies/openid_connect.rb:155:in 'other_phase'
    from omniauth/strategy.rb:190:in 'call!'
    from omniauth/strategy.rb:169:in 'call'
    from omniauth/builder.rb:45:in 'call'
    from config/initializers/omniauth_param_capture.rb:17:in 'call'
    from rack/attack.rb:127:in 'call'
    from scout_apm/middleware.rb:17:in 'call'
    from http_accept_language/middleware.rb:14:in 'call'
    from logtail-rails/error_event.rb:24:in 'call'
    from logtail-rack/http_events.rb:213:in 'call'
    from logtail-rack/user_context.rb:74:in 'call'
    from logtail-rails/session_context.rb:16:in 'call'
    from logtail-rack/http_context.rb:23:in 'block in call'
    from logtail/current_context.rb:120:in 'with'
    from logtail/current_context.rb:44:in 'with'
    from logtail-rack/http_context.rb:22:in 'call'
    from warden/manager.rb:36:in 'block in call'
    from warden/manager.rb:34:in 'catch'
    from warden/manager.rb:34:in 'call'
    from rack/tempfile_reaper.rb:15:in 'call'
    from rack/etag.rb:27:in 'call'
    from rack/conditional_get.rb:27:in 'call'
    from rack/head.rb:12:in 'call'
    from action_dispatch/http/permissions_policy.rb:36:in 'call'
    from action_dispatch/http/content_security_policy.rb:36:in 'call'
    from rack/session/abstract/id.rb:266:in 'context'
    from rack/session/abstract/id.rb:260:in 'call'
    from action_dispatch/middleware/cookies.rb:689:in 'call'
    from action_dispatch/middleware/callbacks.rb:29:in 'block in call'
    from active_support/callbacks.rb:101:in 'run_callbacks'
    from action_dispatch/middleware/callbacks.rb:28:in 'call'
    from rollbar/middleware/rails/rollbar.rb:25:in 'block in call'
    from rollbar.rb:145:in 'scoped'
    from rollbar/middleware/rails/rollbar.rb:22:in 'call'
    from sentry/rails/rescued_exception_interceptor.rb:14:in 'call'
    from action_dispatch/middleware/debug_exceptions.rb:29:in 'call'
    from rollbar/middleware/rails/show_exceptions.rb:27:in 'call_with_rollbar'
    from sentry/rack/capture_exceptions.rb:30:in 'block (2 levels) in call'
    from sentry/hub.rb:269:in 'with_session_tracking'
    from sentry-ruby.rb:416:in 'with_session_tracking'
    from sentry/rack/capture_exceptions.rb:21:in 'block in call'
    from sentry/hub.rb:59:in 'with_scope'
    from sentry-ruby.rb:396:in 'with_scope'
    from sentry/rack/capture_exceptions.rb:20:in 'call'
    from action_dispatch/middleware/show_exceptions.rb:31:in 'call'
    from rescue_registry/action_dispatch/show_exceptions.rb:11:in 'call'
    from rescue_registry/reset_context.rb:9:in 'call'
    from rails/rack/logger.rb:37:in 'call_app'
    from rails/rack/logger.rb:26:in 'call'
    from ahoy/engine.rb:22:in 'call_with_quiet_ahoy'
    from action_dispatch/middleware/remote_ip.rb:92:in 'call'
    from request_store/middleware.rb:19:in 'call'
    from action_dispatch/middleware/request_id.rb:28:in 'call'
    from rack/method_override.rb:24:in 'call'
    from rack/runtime.rb:22:in 'call'
    from judoscale/request_middleware.rb:41:in 'call'
    from active_support/cache/strategy/local_cache_middleware.rb:29:in 'call'
    from action_dispatch/middleware/executor.rb:14:in 'call'
    from action_dispatch/middleware/static.rb:25:in 'call'
    from rack/sendfile.rb:110:in 'call'
    from action_dispatch/middleware/ssl.rb:79:in 'call'
    from action_dispatch/middleware/static.rb:25:in 'call'
    from scout_apm/instruments/middleware_summary.rb:58:in 'call'
    from rails/engine.rb:536:in 'call'
    from puma/configuration.rb:279:in 'call'
    from puma/request.rb:99:in 'block in handle_request'
    from puma/thread_pool.rb:389:in 'with_force_shutdown'
    from puma/request.rb:98:in 'handle_request'
    from puma/server.rb:468:in 'process_client'
    from puma/server.rb:249:in 'block in run'
    from puma/thread_pool.rb:166:in 'block in spawn_thread'

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board

💡 New Feature

Date

6 days ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.