0

After upgrading to OS X 10.14, my rails application no longer works. I'm trying to figure out why. I get an exception raised by active_support_(5.0.0.1)_lib/active_support/message_encryptor.rb on a line that tries to assign @secret to cipher.key. The exception says that key must be 32 bytes.

At this point in my attempt to resolve, I'm wondering why running bundle install from the application directory reports that it's installing activesupport 5.0.7.2, but when the application runs (via puma) the exception is thrown by code in activesupport 5.0.0.1. rvm is my ruby version manager. It reports that it's running ruby 2.4.1 (which is the version I had installed before the upgrade). I think OS X 10.14 comes with 2.3.7, but that doesn't seem to be an issue. Rails is at version 5.0.0.1. I thought I'd try to update Rails to 5.0.7.2. I read the Upgrading Ruby on Rails page and modified my Gemfile to specify rails ~= 5.0.7 (used to say ~> 5.0.2), then ran rake rails::update which produces an error saying 'You have already activated rake 12.3.2 but your Gemfile requires rake 11.3.0.'. I can't find a reference to rake in my Gemfile. The error is thrown by boot.rb on the require 'bundler/setup'.

I'm hoping someone might be able to tell me how to update rails to a more recent version in the hopes that having done that, my initial problem will disappear. Full stack from server log:

ArgumentError (key must be 32 bytes):

activesupport (5.0.0.1) lib/active_support/message_encryptor.rb:72:in `key='
activesupport (5.0.0.1) lib/active_support/message_encryptor.rb:72:in `_encrypt'
activesupport (5.0.0.1) lib/active_support/message_encryptor.rb:58:in `encrypt_and_sign'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:592:in `commit'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:465:in `[]='
actionpack (5.0.0.1) lib/action_dispatch/middleware/session/cookie_store.rb:117:in `set_cookie'
rack (2.0.1) lib/rack/session/abstract/id.rb:353:in `commit_session'
rack (2.0.1) lib/rack/session/abstract/id.rb:224:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.0.1) lib/active_record/migration.rb:552:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) > lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.12.0) lib/puma/configuration.rb:225:in `call'
puma (3.12.0) lib/puma/server.rb:658:in `handle_request'
puma (3.12.0) lib/puma/server.rb:472:in `process_client'
puma (3.12.0) lib/puma/server.rb:332:in `block in run'
puma (3.12.0) lib/puma/thread_pool.rb:133:in `block in spawn_thread'
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (1.8ms)
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.1ms)
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.6ms)
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (84.1ms)
Started PUT "/__web_console/repl_sessions/2b97efeccea3498fd96b79db013b3da9" for 127.0.0.1 at 2019-03-26 10:59:35 -0400
Started PUT "/__web_console/repl_sessions/2b97efeccea3498fd96b79db013b3da9" for 127.0.0.1 at 2019-03-26 10:59:36 -0400

From Gemfile.lock:

    actioncable (5.0.7.2)
      actionpack (= 5.0.7.2)
      nio4r (>= 1.2, < 3.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.7.2)
      actionpack (= 5.0.7.2)
      actionview (= 5.0.7.2)
      activejob (= 5.0.7.2)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.7.2)
      actionview (= 5.0.7.2)
      activesupport (= 5.0.7.2)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.7.2)
      activesupport (= 5.0.7.2)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.0.7.2)
      activesupport (= 5.0.7.2)
      globalid (>= 0.3.6)
    activemodel (5.0.7.2)
      activesupport (= 5.0.7.2)
    activerecord (5.0.7.2)
      activemodel (= 5.0.7.2)
      activesupport (= 5.0.7.2)
      arel (~> 7.0)
    activesupport (5.0.7.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
.
.
.
    railties (5.0.7.2)
      actionpack (= 5.0.7.2)
      activesupport (= 5.0.7.2)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.3.2)
rdiddly
  • 343
  • 1
  • 3
  • 13
  • 1
    Can you post the full stack trace of the error from your server logs? Also check your activesupport gem version in your Gemfile.lock. You can also control+f search your Gemfile.lock for rake. My impression is that some other gem requires that earlier version of rake.`You might be able to get away with bundle update but make sure you have a git commit before doing that! https://bundler.io/v2.0/guides/updating_gems.html "This will resolve dependencies from scratch, ignoring the Gemfile.lock. If you do this, keep git reset --hard" – ekr990011 Mar 26 '19 at 18:11

1 Answers1

0

What looks good is that it from your stack trace it is using the correct ruby version. What seems off is that your gemfile.lock is saying you are locked into other gems so why is it not running them? (activesupport 5.0.0.1 not 5.0.7.2)

Personally I think you need to bundle update / and or delete the lock and run bundle install again. Or track down the trouble maker gems and update them. Perhaps even putting ruby '2.4.1' in your gemfile might lock your bundler into making sure it is using the right ruby version. One thing that might help you find the gem(s) that are using that old rake: gem dependency rake --reverse-dependencies How do I find out which gem has a specific dependency? Then search up to the rake 11.3.0 and see what is using it.

You actually have an old error that has been talked about: https://github.com/rails/rails/issues/25185 Which was supposedly fixed by: https://github.com/rails/rails/pull/25192

The question is why is your rails acting like it is still running 5.0.0.1 when you have upgraded? I wonder if your 2.4.1 rvm gems file has the new upgraded gems or if your bundler is somehow installing them into a different version. Maybe also check bundle show activesupport to see the trace leads back to your rvm 2.4.1 folder.

This guy may have a possible answer for you he answered his own question: Rails 5 production error activesupport

So perhaps a full upgrade up to a higher rails might save you.

Hopefully some of this gets you down the right path!

ekr990011
  • 724
  • 2
  • 7
  • 23