简体   繁体   中英

Deploy rails app with ActionCable to Heroku

I created simple online chat using ROR and ActionCable. And then try to deploy app to heroku.

But I have a strange error after deploy and app wont run.

Heroku build log:

   .........
   Bundle completed (0.70s)
   Cleaning up the bundler cache.
   Could not detect rake tasks
   ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
   and using the production group of your Gemfile.
   rake aborted!
   TypeError: nil is not a symbol
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `module_function'
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `<module:ActionCable>'
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:22:in `<top (required)>'
   .........

action_cable.rb from github:

  # Singleton instance of the server
  module_function def server       #line #29
    @server ||= ActionCable::Server::Base.new
  end

Gemfile

gem 'actioncable', github: 'rails/actioncable'

At local machine all work fine. Any ideas?

Source, if it will help: https://github.com/kokosko/chat/

This sounds like you were running ruby 2.0 or lower. Rails 5.0 requires ruby 2.2.

The precise cause for this error message is that in previous versions of ruby

def foo
end

returns nil, whereas as of ruby 2.1, it will return :foo . The code you posted relies on this change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM