I am transitioning from Heroku to AWS Elastic Beanstalk and in my logs I keep seeing this error with .css and .js assets.
Rails 4.2
Ruby 2.2.5
ActionController::RoutingError (No route matches [GET] "/assets/application-be8de4c1a8d12cb784028972b73fe7e23d4acc55757e3d297ef5e3db4161c369.css"):
vendor/bundle/gems/actionpack-4.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
vendor/bundle/gems/actionpack-4.2.2/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
vendor/bundle/gems/railties-4.2.2/lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundle/gems/railties-4.2.2/lib/rails/rack/logger.rb:20:in `block in call'
vendor/bundle/gems/activesupport-4.2.2/lib/active_support/tagged_logging.rb:68:in `block in tagged'
vendor/bundle/gems/activesupport-4.2.2/lib/active_support/tagged_logging.rb:26:in `tagged'
vendor/bundle/gems/activesupport-4.2.2/lib/active_support/tagged_logging.rb:68:in `tagged'
vendor/bundle/gems/railties-4.2.2/lib/rails/rack/logger.rb:20:in `call'
vendor/bundle/gems/actionpack-4.2.2/lib/action_dispatch/middleware/request_id.rb:21:in `call'
vendor/bundle/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
vendor/bundle/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
vendor/bundle/gems/activesupport-4.2.2/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
vendor/bundle/gems/actionpack-4.2.2/lib/action_dispatch/middleware/static.rb:113:in `call'
vendor/bundle/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
vendor/bundle/gems/actionpack-4.2.2/lib/action_dispatch/middleware/ssl.rb:24:in `call'
vendor/bundle/gems/railties-4.2.2/lib/rails/engine.rb:518:in `call'
vendor/bundle/gems/railties-4.2.2/lib/rails/application.rb:164:in `call'
vendor/bundle/gems/puma-3.6.2/lib/puma/configuration.rb:225:in `call'
vendor/bundle/gems/puma-3.6.2/lib/puma/server.rb:578:in `handle_request'
vendor/bundle/gems/puma-3.6.2/lib/puma/server.rb:415:in `process_client'
vendor/bundle/gems/puma-3.6.2/lib/puma/server.rb:275:in `block in run'
vendor/bundle/gems/puma-3.6.2/lib/puma/thread_pool.rb:116:in `call'
vendor/bundle/gems/puma-3.6.2/lib/puma/thread_pool.rb:116:in `block in spawn_thread'
Help.
Could it be that your configuration file is telling EB to skip asset compilation? See docs here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby.container.html#create_deploy_Ruby.env.console.ruby.envprops
Related
My application uses Active Storage to manage images (attached to articles, user avatars, etc) and I get constant 500 errors when processing links of the following style:
/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBODYwR1E9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--ac33ecf9f5dffc2b8345b443c402562e4fb6afaf/F582BAA7-DD39-4A7A-8E82-919EC8AFC12C.jpeg
These links are sometimes visited by search engine bots, and sometimes because other websites point to images of my application that no longer exist.
To generate the links to the images I use the helper recommended by Rails, which point to the assets through a redirect (url_for(element.attachment) for example).
The thing is that if the assets no longer exist, because a user has changed avatar for example, or because in an article an image has been replaced, these links generate errors with status 500 instead of 404 errors.
Am I confused and I am not using the right helper to generate the image paths? I have investigated in the Ruby Gem and I don't see any option to change the behavior, since the error is given when looking for the ActiveRecord of the blob in database. This is the trace:
vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/core.rb:284:in `find': Couldn't find ActiveStorage::Blob with 'id'=1684686 (ActiveRecord::RecordNotFound)
from vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/signed_id.rb:64:in `find_signed!'
from vendor/bundle/ruby/3.1.0/gems/activestorage-7.0.4/app/models/active_storage/blob.rb:87:in `find_signed!'
from vendor/bundle/ruby/3.1.0/gems/activestorage-7.0.4/app/controllers/concerns/active_storage/set_blob.rb:12:in `set_blob'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:400:in `block in make_lambda'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:200:in `block in halting'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:595:in `block in invoke_before'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:595:in `each'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:595:in `invoke_before'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:116:in `block in run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/actiontext-7.0.4/lib/action_text/rendering.rb:20:in `with_renderer'
from vendor/bundle/ruby/3.1.0/gems/actiontext-7.0.4/lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:127:in `instance_exec'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:138:in `run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/abstract_controller/callbacks.rb:233:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `block in instrument'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:206:in `instrument'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/abstract_controller/base.rb:151:in `process'
from vendor/bundle/ruby/3.1.0/gems/actionview-7.0.4/lib/action_view/rendering.rb:39:in `process'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:188:in `dispatch'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_controller/metal.rb:251:in `dispatch'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:32:in `serve'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `each'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/journey/router.rb:32:in `serve'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/routing/route_set.rb:852:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/rack/browser_monitoring.rb:38:in `traced_call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/http_accept_language-2.1.1/lib/http_accept_language/middleware.rb:14:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/conditional_get.rb:27:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/http/content_security_policy.rb:36:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/cookies.rb:696:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/callbacks.rb:99:in `run_callbacks'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/bugsnag-6.25.0/lib/bugsnag/integrations/rack.rb:51:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:40:in `call_app'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `block in call'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:37:in `tagged'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/tagged_logging.rb:99:in `tagged'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/rack/logger.rb:25:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/request_id.rb:26:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/static.rb:23:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/ssl.rb:77:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/actionpack-7.0.4/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-utf8_sanitizer-1.8.0/lib/rack/utf8_sanitizer.rb:28:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:530:in `call'
from vendor/bundle/ruby/3.1.0/gems/newrelic_rpm-8.13.1/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/configuration.rb:268:in `call'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:89:in `block in handle_request'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:343:in `with_force_shutdown'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:88:in `handle_request'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:430:in `process_client'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:233:in `block in run'
from vendor/bundle/ruby/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:150:in `block in spawn_thread'
Do you have any suggestion to make a better use of Active Storage? Do you avoid the error in any way in your applications?
Thank you very much in advance!
Check if this solves your issue:
Rails.application.routes.url_helpers.polymorphic_url(user.avatar)
I just realized that I am confusing a "500 status error" with an INFO level exception. The application responds fine: it displays a 404 error, but my error handler app gets an INFO level exception and I was interpreting it as my users being shown an error screen, when really the application was handling the situation fine.
I recently started with Rails 6.1 on Windows server. It runs as expected and shows Rails welcome screen. Including the Rails red page if I generate an error in the code.
Then I installed webpack, Yarn etc. and started copying some models from an old application I'd like to reuse. Since then any error in the code breaks Rails: instead of the expected red page, it drops hundreds of lines with the following errors repeated several times:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionview-6.1.4/lib/action_view/template.rb:300: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/web-console-3.7.0/lib/web_console/exception_mapper.rb:31: warning: in `eval'
And then another bloc:
ArgumentError: wrong number of arguments (given 2, expected 3)
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionview-6.1.4/lib/action_view/base.rb:230:in `initialize'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/web-console-3.7.0/lib/web_console/template.rb:21:in `new'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/web-console-3.7.0/lib/web_console/template.rb:21:in `render'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:37:in `block in call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `catch'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionpack-6.1.4/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-6.1.4/lib/rails/rack/logger.rb:37:in `call_app'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-6.1.4/lib/rails/rack/logger.rb:26:in `block in call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:37:in `tagged'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `tagged'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-6.1.4/lib/rails/rack/logger.rb:26:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionpack-6.1.4/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionpack-6.1.4/lib/action_dispatch/middleware/request_id.rb:26:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionpack-6.1.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionpack-6.1.4/lib/action_dispatch/middleware/static.rb:24:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionpack-6.1.4/lib/action_dispatch/middleware/host_authorization.rb:98:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/webpacker-4.3.0/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/rack-proxy-0.7.0/lib/rack/proxy.rb:63:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-6.1.4/lib/rails/engine.rb:539:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/puma-5.4.0/lib/puma/configuration.rb:249:in `call'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/puma-5.4.0/lib/puma/request.rb:77:in `block in handle_request'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/puma-5.4.0/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/puma-5.4.0/lib/puma/request.rb:76:in `handle_request'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/puma-5.4.0/lib/puma/server.rb:440:in `process_client'
from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/puma-5.4.0/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
What did I break ?
I'm running mastodon in server(1 core, 4GB RAM).
It sometimes happens deadrock and server error.
I could not find out when to happen this error, but it did multiple times.
A temporary solution is restarting server for now.
What are causes happening this issue? and How to solve it?
Error Log
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in
/home/mastodon/.rbenv/versions/2.5.0/lib/ruby/2.5.0/delegate.rb:83:in `method_missing'
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack/store_proxy/redis_store_proxy.rb:31:in `in
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack/cache.rb:49:in `do_count'
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack/cache.rb:19:in `count'
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack/throttle.rb:27:in `[]'
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:89:in `block in throttled?'
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:88:in `any?'
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:88:in `throttled?'
vendor/bundle/ruby/2.5.0/gems/rack-attack-5.0.1/lib/rack/attack.rb:143:in `call'
vendor/bundle/ruby/2.5.0/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call'
vendor/bundle/ruby/2.5.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch'
vendor/bundle/ruby/2.5.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/etag.rb:25:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/conditional_get.rb:25:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/head.rb:12:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:232:in `context'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in
vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `c
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `ca
vendor/bundle/ruby/2.5.0/gems/lograge-0.7.1/lib/lograge/rails_ext/rack/logger.rb:15:in `call_app'
vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:24:in `block in call'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb:69:in `block in tag
vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb:26:in `tagged'
vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb:69:in `tagged'
vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:24:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
vendor/bundle/ruby/2.5.0/gems/request_store-1.3.2/lib/request_store/middleware.rb:9:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/runtime.rb:22:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-timeout-0.4.2/lib/rack/timeout/core.rb:122:in `block in call'
vendor/bundle/ruby/2.5.0/gems/rack-timeout-0.4.2/lib/rack/timeout/support/timeout.rb:19:in `timeout'
vendor/bundle/ruby/2.5.0/gems/rack-timeout-0.4.2/lib/rack/timeout/core.rb:121:in `call'
vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in `call'
vendor/bundle/ruby/2.5.0/gems/rack-cors-0.4.1/lib/rack/cors.rb:81:in `call'
vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.11.0/lib/puma/configuration.rb:225:in `call'
vendor/bundle/ruby/2.5.0/gems/puma-3.11.0/lib/puma/server.rb:624:in `handle_request'
vendor/bundle/ruby/2.5.0/gems/puma-3.11.0/lib/puma/server.rb:438:in `process_client'
vendor/bundle/ruby/2.5.0/gems/puma-3.11.0/lib/puma/server.rb:302:in `block in run'
vendor/bundle/ruby/2.5.0/gems/puma-3.11.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
method=GET path=/ format=html controller=HomeController action=index status=401 duration=18.72 view=0.00 d
ThreadError (deadlock; recursive locking):
app/models/setting.rb:26:in `[]'
Config file and env variables
#Puma server settings
WEB_CONCURRENCY=0
MAX_THREADS=5
config/puma.rb
threads_count = ENV.fetch('MAX_THREADS') { 5 }.to_i
threads threads_count, threads_count
if ENV['SOCKET'] then
bind 'unix://' + ENV['SOCKET']
else
port ENV.fetch('PORT') { 3000 }
end
environment ENV.fetch('RAILS_ENV') { 'development' }
workers ENV.fetch('WEB_CONCURRENCY') { 0 }
preload_app!
on_worker_boot do
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
end
plugin :tmp_restart
Thank you in advance.
For me, it was a ruby issue. I was using the wrong version of ruby and I changed the ruby version and it started working after that.
to check the ruby version do:
ruby -v
to change ruby version using rvm
rvm use 2.6.3
I am trying to open the page /page in my Rails app, but I get the following error on the log file:
ActionController::RoutingError (No route matches [GET] "/page"):
.bundle/ruby/2.3.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/railties-4.0.13/lib/rails/rack/logger.rb:38:in `call_app'
.bundle/ruby/2.3.0/gems/railties-4.0.13/lib/rails/rack/logger.rb:20:in `block in call'
.bundle/ruby/2.3.0/gems/activesupport-4.0.13/lib/active_support/tagged_logging.rb:68:in `block in tagged'
.bundle/ruby/2.3.0/gems/activesupport-4.0.13/lib/active_support/tagged_logging.rb:26:in `tagged'
.bundle/ruby/2.3.0/gems/activesupport-4.0.13/lib/active_support/tagged_logging.rb:68:in `tagged'
.bundle/ruby/2.3.0/gems/railties-4.0.13/lib/rails/rack/logger.rb:20:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/request_id.rb:21:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/request_store-1.0.6/lib/request_store/middleware.rb:8:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/rack-1.5.5/lib/rack/runtime.rb:17:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/activesupport-4.0.13/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/rack-1.5.5/lib/rack/sendfile.rb:112:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:80:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/airbrake-4.3.4/lib/airbrake/user_informer.rb:16:in `_call'
.bundle/ruby/2.3.0/gems/airbrake-4.3.4/lib/airbrake/user_informer.rb:12:in `call'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
.bundle/ruby/2.3.0/gems/railties-4.0.13/lib/rails/engine.rb:511:in `call'
.bundle/ruby/2.3.0/gems/railties-4.0.13/lib/rails/application.rb:97:in `call'
.bundle/ruby/2.3.0/gems/railties-4.0.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
.bundle/ruby/2.3.0/gems/newrelic_rpm-4.2.0.334/lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
/usr/local/Cellar/passenger/5.1.5/libexec/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
/usr/local/Cellar/passenger/5.1.5/libexec/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'
/usr/local/Cellar/passenger/5.1.5/libexec/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
/usr/local/Cellar/passenger/5.1.5/libexec/src/ruby_supportlib/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
/usr/local/Cellar/passenger/5.1.5/libexec/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
I looked up in bundle exec rake routes, and it seems like there is a route matches [GET] "/page":
root GET /page(.:format) page#index
Does anyone know how to solve this problem?
my subdomain was wrong. It worked with the right subdomain :)
My Rails app starts but gives me a No Method error. I'm not sure what method is apparently being called on something which doesn't. It can;t be a certain site page as it's happening on every url I try to visit. Anyone able hint where it's failing?
Full stack log:
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/error_frame.rb:7:in `block in from_exception'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/error_frame.rb:4:in `each'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/error_frame.rb:4:in `each_with_index'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/error_frame.rb:4:in `each'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/error_frame.rb:4:in `map'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/error_frame.rb:4:in `from_exception'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/error_page.rb:45:in `backtrace_frames'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/middleware.rb:31:in `log_exception'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/middleware.rb:23:in `rescue in app_call'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/middleware.rb:20:in `app_call'
vendor/ruby/1.9.1/gems/better_errors-0.0.8/lib/better_errors/middleware.rb:14:in `call'
vendor/ruby/1.9.1/gems/bullet-4.1.5/lib/bullet/rack.rb:11:in `call'
vendor/ruby/1.9.1/gems/sass-3.2.0/lib/sass/plugin/rack.rb:54:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:in `call'
vendor/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:in `call'
vendor/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__2841213657923326046__call__4410644436419050805__callbacks'
vendor/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:65:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'
vendor/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
vendor/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
vendor/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
vendor/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
vendor/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
vendor/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call'
vendor/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
/Users/<user>/.rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/<user>/.rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/<user>/.rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Error given:
NoMethodError in PagesController#home
undefined method `[]' for nil:NilClass
I'm sure you quite beyond this but just to chime in, I had the same error. I commented out the better_errors gem, re-bundled, reran my app, and found I was getting an error elsewhere. I don't know why better_errors was unable to handle it but once I fixed that other error, I re-enabled better_errors and everything was back to normal.
It's odd b/c I haven't had any problems with the gem before. I love it.