Internal Server Error with enable_mobile_theme


(nitper) #1

I just updated to the latest (0.9.8.2), and now I get an error when accessing / or /login from a desktop when logged out and enable_mobile_theme is checked. If I am already logged in, the site works normally.

==> thin.2.log <==
Unexpected error while processing request: undefined method `[]' for nil:NilClass
        /var/www/discourse/lib/mobile_detection.rb:13:in `resolve_mobile_view!'
        /var/www/discourse/lib/middleware/anonymous_cache.rb:28:in `is_mobile?'
        /var/www/discourse/lib/middleware/anonymous_cache.rb:33:in `cache_key'
        /var/www/discourse/lib/middleware/anonymous_cache.rb:37:in `cache_key_body'
        /var/www/discourse/lib/middleware/anonymous_cache.rb:53:in `cached'
        /var/www/discourse/lib/middleware/anonymous_cache.rb:102:in `call'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/engine.rb:511:in `call'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:97:in `call'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/urlmap.rb:65:in `block in call'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `each'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `call'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/connection.rb:82:in `block in pre_process'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/connection.rb:80:in `catch'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/connection.rb:80:in `pre_process'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/connection.rb:55:in `process'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/connection.rb:41:in `receive_data'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/backends/base.rb:73:in `start'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/server.rb:162:in `start'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/controllers/controller.rb:87:in `start'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/runner.rb:200:in `run_command'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/lib/thin/runner.rb:156:in `run!'
        /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/thin-1.6.1/bin/thin:6:in `<top (required)>'
        /usr/local/rvm/gems/ruby-2.0.0-p353@discourse/bin/thin:23:in `load'
        /usr/local/rvm/gems/ruby-2.0.0-p353@discourse/bin/thin:23:in `<main>'
        /usr/local/rvm/gems/ruby-2.0.0-p353@discourse/bin/ruby_executable_hooks:15:in `eval'
        /usr/local/rvm/gems/ruby-2.0.0-p353@discourse/bin/ruby_executable_hooks:15:in `<main>'

If I turn off enable_mobile_theme it works fine. Any ideas?


(Sam Saffron) #2

I just submitted a patch, can you try latest?


(nitper) #3

That didn’t work, but this did:
https://github.com/discourse/discourse/pull/1836


(Sam Saffron) #4

Curious to why there is no env rack session.

Can you:

  1. Get me the output of RAILS_ENV=production bundle exec rake middleware
  2. Let me know what you are hosted on (thin, apache, passenger, unicorn?)

(nitper) #5

Thanks for the quick responses - I’ll be on a plane for most of the day, but I’ll report back later tonight.


(Sam Saffron) #6

whatever this was, it is fixed


(Sam Saffron) #7