I hit the following error in a Rails 7 prod instance while trying to use the console command:
console_command = "rails console"
The error I got:
Connecting to xxxxxxxxxxxx... complete
[07/10/23 09:16:53 +0000 xxxxxx (242)] INFO : No configuration file loaded, and no configuration found in ENV. For assistance configuring Scout, visit https://docs.scoutapm.com/#ruby-configuration-options
[07/10/23 09:16:53 +0000 xxxxxx (242)] INFO : Scout Agent [5.2.0] Initialized
[07/10/23 09:16:53 +0000 xxxxxx (242)] INFO : Not Loading Instruments
[07/10/23 09:16:53 +0000 xxxxxx (242)] INFO : Scout Agent [5.2.0] Installed
[07/10/23 09:16:53 +0000 xxxxxx (242)] INFO : Monitoring isn't enabled for the [production] environment.
[07/10/23 09:16:53 +0000 xxxxxx (242)] INFO : Deferring agent start. Standing by for first request
/usr/local/bundle/gems/spring-4.0.0/lib/spring/application.rb:101:in `block in preload': Spring reloads, and therefore needs the application to have reloading enabled.
Please, set config.cache_classes to false in config/environments/production.rb.
(RuntimeError)
from /usr/local/bundle/gems/railties-7.0.3.1/lib/rails/initializable.rb:32:in `instance_exec'
from /usr/local/bundle/gems/railties-7.0.3.1/lib/rails/initializable.rb:32:in `run'
from /usr/local/bundle/gems/railties-7.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
from /usr/local/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
from /usr/local/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/local/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each'
from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `call'
from /usr/local/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/local/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
from /usr/local/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
from /usr/local/bundle/gems/railties-7.0.3.1/lib/rails/initializable.rb:60:in `run_initializers'
from /usr/local/bundle/gems/railties-7.0.3.1/lib/rails/application.rb:372:in `initialize!'
from /app/config/environment.rb:5:in `<main>'
from /usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/local/bundle/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
from /usr/local/bundle/gems/spring-4.0.0/lib/spring/application.rb:108:in `preload'
from /usr/local/bundle/gems/spring-4.0.0/lib/spring/application.rb:162:in `serve'
from /usr/local/bundle/gems/spring-4.0.0/lib/spring/application.rb:144:in `block in run'
from /usr/local/bundle/gems/spring-4.0.0/lib/spring/application.rb:138:in `loop'
from /usr/local/bundle/gems/spring-4.0.0/lib/spring/application.rb:138:in `run'
from /usr/local/bundle/gems/spring-4.0.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/usr/local/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from -e:1:in `<main>'