bensheldon / good_job

Multithreaded, Postgres-based, Active Job backend for Ruby on Rails.
https://goodjob-demo.herokuapp.com/
MIT License
2.64k stars 195 forks source link

Email job breaks dashboard #313

Open sebastiandeutsch opened 3 years ago

sebastiandeutsch commented 3 years ago

Hi,

I have a simple email job and when perform it the dashboard will throw the following error while the job is queued (the job actual works):

arguments passed to url_for can't be handled. Please require routes or provide your own implementation

Showing /home/app/server/staging/shared/bundle/ruby/2.7.0/gems/good_job-1.11.3/engine/app/views/good_job/dashboards/index.html.erb where line #46 raised:

          _back_url
        else
          raise ArgumentError, "arguments passed to url_for can't be handled. Please require " \
                               "routes or provide your own implementation"
        end
      end

StackTrace:

actionview (6.0.3.2) lib/action_view/helpers/url_helper.rb:40:in `url_for'
actionview (6.0.3.2) lib/action_view/helpers/url_helper.rb:202:in `link_to'
good_job (1.11.3) engine/app/views/good_job/dashboards/index.html.erb:46
actionview (6.0.3.2) lib/action_view/base.rb:274:in `_run'
actionview (6.0.3.2) lib/action_view/template.rb:185:in `block in render'
activesupport (6.0.3.2) lib/active_support/notifications.rb:182:in `instrument'
actionview (6.0.3.2) lib/action_view/template.rb:385:in `instrument_render_template'
actionview (6.0.3.2) lib/action_view/template.rb:183:in `render'
actionview (6.0.3.2) lib/action_view/renderer/template_renderer.rb:58:in `block (2 levels) in render_template'
actionview (6.0.3.2) lib/action_view/renderer/abstract_renderer.rb:88:in `block in instrument'
activesupport (6.0.3.2) lib/active_support/notifications.rb:180:in `block in instrument'
activesupport (6.0.3.2) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.0.3.2) lib/active_support/notifications.rb:180:in `instrument'
actionview (6.0.3.2) lib/action_view/renderer/abstract_renderer.rb:87:in `instrument'
actionview (6.0.3.2) lib/action_view/renderer/template_renderer.rb:57:in `block in render_template'
actionview (6.0.3.2) lib/action_view/renderer/template_renderer.rb:65:in `render_with_layout'
actionview (6.0.3.2) lib/action_view/renderer/template_renderer.rb:56:in `render_template'
actionview (6.0.3.2) lib/action_view/renderer/template_renderer.rb:13:in `render'
actionview (6.0.3.2) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
actionview (6.0.3.2) lib/action_view/renderer/renderer.rb:29:in `render_to_object'
actionview (6.0.3.2) lib/action_view/rendering.rb:117:in `block in _render_template'
actionview (6.0.3.2) lib/action_view/base.rb:304:in `in_rendering_context'
actionview (6.0.3.2) lib/action_view/rendering.rb:116:in `_render_template'
actionpack (6.0.3.2) lib/action_controller/metal/streaming.rb:218:in `_render_template'
actionview (6.0.3.2) lib/action_view/rendering.rb:103:in `render_to_body'
actionpack (6.0.3.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (6.0.3.2) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
actionpack (6.0.3.2) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (6.0.3.2) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (6.0.3.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (6.0.3.2) lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
activesupport (6.0.3.2) lib/active_support/core_ext/benchmark.rb:14:in `ms'
actionpack (6.0.3.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (6.0.3.2) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (6.0.3.2) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
actionpack (6.0.3.2) lib/action_controller/metal/instrumentation.rb:43:in `render'
actionpack (6.0.3.2) lib/action_controller/metal/implicit_render.rb:35:in `default_render'
actionpack (6.0.3.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `block in send_action'
actionpack (6.0.3.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `tap'
actionpack (6.0.3.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.0.3.2) lib/abstract_controller/base.rb:195:in `process_action'
actionpack (6.0.3.2) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.0.3.2) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.0.3.2) lib/active_support/callbacks.rb:135:in `run_callbacks'
actionpack (6.0.3.2) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.0.3.2) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.0.3.2) lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
activesupport (6.0.3.2) lib/active_support/notifications.rb:180:in `block in instrument'
activesupport (6.0.3.2) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.0.3.2) lib/active_support/notifications.rb:180:in `instrument'
actionpack (6.0.3.2) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
actionpack (6.0.3.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (6.0.3.2) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.0.3.2) lib/abstract_controller/base.rb:136:in `process'
actionview (6.0.3.2) lib/action_view/rendering.rb:39:in `process'
actionpack (6.0.3.2) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.0.3.2) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.0.3.2) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.0.3.2) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.0.3.2) lib/action_dispatch/journey/router.rb:49:in `block in serve'
actionpack (6.0.3.2) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.0.3.2) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.0.3.2) lib/action_dispatch/routing/route_set.rb:834:in `call'
rack (2.2.3) lib/rack/auth/basic.rb:28:in `call'
railties (6.0.3.2) lib/rails/engine.rb:527:in `call'
railties (6.0.3.2) lib/rails/railtie.rb:190:in `public_send'
railties (6.0.3.2) lib/rails/railtie.rb:190:in `method_missing'
actionpack (6.0.3.2) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (6.0.3.2) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (6.0.3.2) lib/action_dispatch/journey/router.rb:49:in `block in serve'
actionpack (6.0.3.2) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.0.3.2) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.0.3.2) lib/action_dispatch/routing/route_set.rb:834:in `call'
apollo_upload_server (2.0.2) lib/apollo_upload_server/middleware.rb:20:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/etag.rb:27:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (6.0.3.2) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/cookies.rb:648:in `call'
activerecord (6.0.3.2) lib/active_record/migration.rb:567:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.0.3.2) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (6.0.3.2) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.3.2) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.0.3.2) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.3.2) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.3.2) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.3.2) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.3.2) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.3.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.0.3.2) lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
rack-cors (1.1.1) lib/rack/cors.rb:100:in `call'
railties (6.0.3.2) lib/rails/engine.rb:527:in `call'
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:107:in `process_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'

any idea where that comes from?

bensheldon commented 3 years ago

@sebastiandeutsch that's unexpected! I'll see if I can reproduce this error.

This is the offending link_to that seems to be erroring: https://github.com/bensheldon/good_job/blob/e769a520f4a0903df989f6b8a81a49acfa4c8c98/engine/app/views/good_job/dashboards/index.html.erb#L46-L48

I did some light googling and I wonder if this maybe applies somewhere in your application? https://stackoverflow.com/a/20817541/241735

bensheldon commented 3 years ago

I'm unable to reproduce this error 😞

bensheldon commented 2 years ago

Closing this because of inactivity. Please comment if you are still seeing this.

adentaofftake commented 8 months ago

Encountering something similar when I visit my good_job index!

adenta commented 8 months ago

This stackoverflow issue solved my problems!

I had a model with include Rails.application.routes.url_helpers. Removing that fixed things. Seems like a legitimate bug in good_job, now with a reproducible way to trigger the issue.

bensheldon commented 8 months ago

oooooh! @adenta thanks for sharing that! I'll try to reproduce that case and see if I can fix it 🙌🏻

bensheldon commented 8 months ago

@adenta Does this describe what you discovered in your codebase?

There was an include Rails.application.routes.url_helpers at the start of a file for a [model] instead of being inside the class

adenta commented 8 months ago

yes. All I had to do was remove the include Rails.application.routes.url_helpers and everything was fixed

On Wed, Jan 10, 2024 at 10:29 AM bensheldon @.***> wrote:

@adenta https://github.com/adenta Does this describe what you discovered in your codebase?

There was an include Rails.application.routes.url_helpers at the start of a file for a [model] instead of being inside the class

— Reply to this email directly, view it on GitHub https://github.com/bensheldon/good_job/issues/313#issuecomment-1885068229, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGUU5WAPJ4Y6CHTJOARQCDYN2XUVAVCNFSM5BBBSAJ2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBYGUYDMOBSGI4Q . You are receiving this because you were mentioned.Message ID: @.***>