Rake任务在本地工作,但不在Heroku上工作

时间:2015-03-07 19:42:00

标签: ruby-on-rails heroku rake-task

我有一个rake任务,可以将数据加载到我的数据库的表中。我最近对我的架构进行了更改,将它们迁移到heroku似乎运行正常。但是,当我运行我的rake任务时,我收到以下错误消息: Don't know how to build task 'import_foursquare_response:create_records'

和一个不太有用的堆栈跟踪:

heroku run rake import_foursquare_response:create_records --trace
Your version of git is 2.2.0. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
Running `rake import_foursquare_response:create_records --trace` attached to terminal... up, run.5353
rake aborted!
Don't know how to build task 'import_foursquare_response:create_records'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/task_manager.rb:62:in `[]'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:149:in `invoke_task'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'

我所看到的大多数问题都指出了人们编写实际佣金任务的语法错误,但我无法看到任何问题。

require 'four_square'

namespace :import_foursquare_response do
  include FourSquare

  desc "Load database with results of API calls"
  task :create_records => :environment do
    puts "Loading database..."

非常感谢任何帮助。没有数据让我的应用无用。

1 个答案:

答案 0 :(得分:-1)

我猜这只是因为heroku没有使用rake任务进行任何磁盘写入,请参阅下文:

Heroku Limitations

Src:https://devcenter.heroku.com/articles/rake