I am trying to run the rails web-console from https://github.com/rails/web-console in production. I know there are warnings against doing this, but the app where I intend to use it is internal and not accessible in production.
Configurations I've used:
config.web_console.development_only = false
config.web_console.whitelisted_ips = %w(<IPs that should have permission>)
So the console ends up working perfectly in development and test, but fails with a very weird error in production.
ArgumentError: wrong number of arguments (given 0, expected 1)
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/core_ext/kernel/reporting.rb:89:in `capture`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/view.rb:34:in `render`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/template.rb:20:in `render`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/middleware.rb:36:in `block in call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/middleware.rb:18:in `catch`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/middleware.rb:18:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/rack/logger.rb:38:in `call_app`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `block in call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/request_id.rb:21:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/static.rb:116:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/engine.rb:518:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/application.rb:165:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call`
from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service`
from /Users/someuser/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service`
from /Users/someuser/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run`
from /Users/someuser/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread`
Can I modify the gem somehow to make it work? Or is there a workaround?
Ruby: v2.3.1 Rails: v4.2.1 web-console: v3.3.0
Thank you
UPDATE:
I found a solution to the problem. It has something to do with how the gem handles logging. I am still not sure why it works in development and not in production though. Here is what I did to get it to work
I added the following code to config/initializers/web_console.rb
WebConsole::View.class_eval do
def render(*)
super
end
end
Essentially, I've overridden the render(*) method located at https://github.com/rails/web-console/commit/4ba9f5044f9322ea16f97e69b7167170c9c34522
Thanks for the help everyone