Heroku: NoMethodError: undefined method `timeout=' for Rack::Timeout:Class
Heroku: NoMethodError: undefined method `timeout=' for Rack::Timeout:Class
刚刚将 Rails 4.2 应用程序更新到 5.2.1,但无法将其推送到 Heroku。下面的错误。我已经通过将以下内容添加到我的 rack_timeout.rb 初始化程序来尝试 here and here 推荐的内容。
Rails.application.config.middleware.insert_before Rack::Runtime, Rack::Timeout, service_timeout: 5
但这无济于事。想法?
$ git push heroku
...
remote: -----> Installing node-v8.10.0-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: NoMethodError: undefined method `timeout=' for Rack::Timeout:Class
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/config/initializers/rack_timeout.rb:2:in `<top (required)>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `load'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `block in load'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `load'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:657:in `block in load_config_initializer'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:656:in `load_config_initializer'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:613:in `each'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:613:in `block in <class:Engine>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `instance_exec'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `run'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `each'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:60:in `run_initializers'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:361:in `initialize!'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/config/environment.rb:5:in `<top (required)>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:337:in `require_environment!'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:520:in `block in run_tasks_blocks'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/airbrake-7.4.0/lib/airbrake/rake.rb:17:in `execute'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/airbrake-7.4.0/lib/airbrake/rake.rb:17:in `execute'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
remote: Tasks: TOP => environment
remote: (See full trace by running task with --trace)
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
在第 2 行的 config/initializers/rack_timeout.rb
中,您正在做 Rack::Timeout.timeout =
最新版本的 rack timeout 中不再存在此方法。由于您升级了,您也需要更改您的代码。
rack-timeout 自述文件指出了如何使用 rails 应用程序配置 rack-timeout:https://github.com/heroku/rack-timeout#rails-apps-manually
刚刚将 Rails 4.2 应用程序更新到 5.2.1,但无法将其推送到 Heroku。下面的错误。我已经通过将以下内容添加到我的 rack_timeout.rb 初始化程序来尝试 here and here 推荐的内容。
Rails.application.config.middleware.insert_before Rack::Runtime, Rack::Timeout, service_timeout: 5
但这无济于事。想法?
$ git push heroku
...
remote: -----> Installing node-v8.10.0-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: NoMethodError: undefined method `timeout=' for Rack::Timeout:Class
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/config/initializers/rack_timeout.rb:2:in `<top (required)>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `load'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `block in load'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:281:in `load'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:657:in `block in load_config_initializer'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:656:in `load_config_initializer'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:613:in `each'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:613:in `block in <class:Engine>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `instance_exec'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `run'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `each'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:60:in `run_initializers'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:361:in `initialize!'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/config/environment.rb:5:in `<top (required)>'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:337:in `require_environment!'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:520:in `block in run_tasks_blocks'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/airbrake-7.4.0/lib/airbrake/rake.rb:17:in `execute'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/airbrake-7.4.0/lib/airbrake/rake.rb:17:in `execute'
remote: /tmp/build_c66056b406a6fcdc37b9dde3124992ce/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
remote: Tasks: TOP => environment
remote: (See full trace by running task with --trace)
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
在第 2 行的 config/initializers/rack_timeout.rb
中,您正在做 Rack::Timeout.timeout =
最新版本的 rack timeout 中不再存在此方法。由于您升级了,您也需要更改您的代码。
rack-timeout 自述文件指出了如何使用 rails 应用程序配置 rack-timeout:https://github.com/heroku/rack-timeout#rails-apps-manually