Heroku错误“我们很抱歉,但出了点问题”

时间:2013-05-18 12:52:53

标签: ruby heroku

我在使用Heroku.com服务发布我的ROR项目时遇到问题... 我已完成此tutrial

的所有步骤

但是当我在运行命令“heroku open”时,我有一个错误“我们很抱歉,但出了问题”,那么我做错了什么?

我已经迁移了数据库,但我认为这个错误与数据库连接,这里是heroku日志:

    2013-05-18T12:33:19.546366+00:00 heroku[slugc]: Slug compilation started
2013-05-18T12:34:56.655486+00:00 heroku[api]: Scale to web=1 by vladimir90@inbox.lv
2013-05-18T12:34:57.187082+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_COPPER resource by vladimir90@inbox.lv
2013-05-18T12:34:57.224557+00:00 heroku[api]: Release v3 created by vladimir90@inbox.lv
2013-05-18T12:34:57.308368+00:00 heroku[api]: Add DATABASE_URL config by vladimir90@inbox.lv
2013-05-18T12:34:57.349978+00:00 heroku[api]: Release v4 created by vladimir90@inbox.lv
2013-05-18T12:34:57.408192+00:00 heroku[api]: Add  config by vladimir90@inbox.lv
2013-05-18T12:34:57.442261+00:00 heroku[api]: Release v5 created by vladimir90@inbox.lv
2013-05-18T12:34:57.493006+00:00 heroku[api]: Deploy fe74901 by vladimir90@inbox.lv
2013-05-18T12:34:57.519764+00:00 heroku[api]: Release v6 created by vladimir90@inbox.lv
2013-05-18T12:34:57.570144+00:00 heroku[api]: Deploy fe74901 by vladimir90@inbox.lv
2013-05-18T12:34:57.994564+00:00 heroku[slugc]: Slug compilation finished
2013-05-18T12:34:59.186250+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e $RAILS_ENV -p 28759`
2013-05-18T12:34:59.616410+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e $RAILS_ENV -p 50832`
2013-05-18T12:35:01.755960+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-18T12:35:01.755960+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-18T12:35:01.756255+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-18T12:35:03.393994+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-18T12:35:03.392166+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-18T12:35:03.394482+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-18T12:35:03.622905+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-05-18T12:35:05.302411+00:00 app[web.1]: >> Maximum connections set to 1024
2013-05-18T12:35:05.300907+00:00 app[web.1]: >> Thin web server (v1.5.1 codename Straight Razor)
2013-05-18T12:35:05.302411+00:00 app[web.1]: >> Listening on 0.0.0.0:28759, CTRL+C to stop
2013-05-18T12:35:05.630396+00:00 heroku[web.1]: State changed from starting to up
2013-05-18T12:35:07.084035+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-05-18T12:35:09.555272+00:00 app[web.1]: >> Thin web server (v1.5.1 codename Straight Razor)
2013-05-18T12:35:09.555449+00:00 app[web.1]: >> Maximum connections set to 1024
2013-05-18T12:35:09.555590+00:00 app[web.1]: >> Listening on 0.0.0.0:50832, CTRL+C to stop
2013-05-18T12:35:13.720603+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-05-18T12:35:16.014857+00:00 heroku[web.1]: Process exited with status 0
2013-05-18T12:38:10.548264+00:00 heroku[api]: Scale to web=1 by vladimir90@inbox.lv
2013-05-18T12:39:35.438944+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by vladimir90@inbox.lv
2013-05-18T12:39:38.857061+00:00 heroku[run.2831]: Awaiting client
2013-05-18T12:39:38.879446+00:00 heroku[run.2831]: Starting process with command `bundle exec rake db:migrate`
2013-05-18T12:39:40.061754+00:00 heroku[run.2831]: State changed from starting to up
2013-05-18T12:40:10.270266+00:00 heroku[run.2831]: State changed from up to complete
2013-05-18T12:40:10.255030+00:00 heroku[run.2831]: Process exited with status 1
2013-05-18T12:41:05.857726+00:00 heroku[api]: Starting process with command `bundle exec rake db:drop` by vladimir90@inbox.lv
2013-05-18T12:41
:13.440682+00:00 heroku[run.3156]: Awaiting client
2013-05-18T12:41:13.496798+00:00 heroku[run.3156]: Starting process with command `bundle exec rake db:drop`
2013-05-18T12:41:14.317214+00:00 heroku[run.3156]: State changed from starting to up
2013-05-18T12:41:18.771015+00:00 heroku[run.3156]: Process exited with status 0
2013-05-18T12:41:18.786550+00:00 heroku[run.3156]: State changed from up to complete
2013-05-18T12:41:56.728233+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by vladimir90@inbox.lv
2013-05-18T12:41:58.722421+00:00 heroku[run.2678]: Awaiting client
2013-05-18T12:41:58.743284+00:00 heroku[run.2678]: Starting process with command `bundle exec rake db:migrate`
2013-05-18T12:42:05.452581+00:00 heroku[run.2678]: Process exited with status 1
2013-05-18T12:42:05.473489+00:00 heroku[run.2678]: State changed from up to complete
2013-05-18T12:41:59.493538+00:00 heroku[run.2678]: State changed from starting to up
2013-05-18T12:43:44.162348+00:00 heroku[api]: Starting process with command `db:migrate` by vladimir90@inbox.lv
2013-05-18T12:43:48.582497+00:00 heroku[run.6317]: Awaiting client
2013-05-18T12:43:48.595152+00:00 heroku[run.6317]: Starting process with command `db:migrate`
2013-05-18T12:43:50.136438+00:00 heroku[run.6317]: Process exited with status 127
2013-05-18T12:43:50.153625+00:00 heroku[run.6317]: State changed from starting to complete
2013-05-18T12:43:58.600834+00:00 heroku[run.6317]: Stopping process with SIGKILL
2013-05-18T12:43:58.600579+00:00 heroku[run.6317]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
2013-05-18T12:44:04.921978+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by vladimir90@inbox.lv
2013-05-18T12:44:07.469110+00:00 heroku[run.1605]: Awaiting client
2013-05-18T12:44:07.493587+00:00 heroku[run.1605]: Starting process with command `bundle exec rake db:migrate`
2013-05-18T12:44:08.483461+00:00 heroku[run.1605]: State changed from starting to up
2013-05-18T12:44:20.496304+00:00 heroku[run.1605]: State changed from up to complete
2013-05-18T12:44:20.483493+00:00 heroku[run.1605]: Process exited with status 1
2013-05-18T12:44:28.137123+00:00 app[web.1]: Started GET "/" for 78.154.136.249 at 2013-05-18 12:44:28 +0000
2013-05-18T12:44:28.203884+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-05-18T12:44:28.205394+00:00 app[web.1]:                                         ^
2013-05-18T12:44:28.208346+00:00 heroku[router]: at=info method=GET path=/ host=murmuring-sierra-7529.herokuapp.com fwd="78.154.136.249" dyno=web.1 connect=5ms service=82ms status=500 bytes=643
2013-05-18T12:44:28.205394+00:00 app[web.1]:                      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2013-05-18T12:44:28.199798+00:00 app[web.1]: Processing by CatalogController#index as HTML
2013-05-18T12:44:28.205394+00:00 app[web.1]: 
2013-05-18T12:44:28.205394+00:00 app[web.1]: LINE 5:              WHERE a.attrelid = '"carts"'::regclass
2013-05-18T12:44:28.205670+00:00 app[web.1]:   app/controllers/application_controller.rb:21:in `initialize_cart'
2013-05-18T12:44:28.205394+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-05-18T12:44:28.205670+00:00 app[web.1]:              ORDER BY a.attnum
2013-05-18T12:44:28.205394+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-05-18T12:44:28.205394+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2013-05-18T12:44:28.205670+00:00 app[web.1]: ):
2013-05-18T12:44:28.205394+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2013-05-18T12:44:28.205394+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "carts" does not exist
2013-05-18T12:44:28.205394+00:00 app[web.1]:              WHERE a.attrelid = '"carts"'::regclass
2013-05-18T12:44:28.205670+00:00 app[web.1]: 
2013-05-18T12:44:28.205670+00:00 app[web.1]: 
2013-05-18T12:44:28.419883+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=murmuring-sierra-7529.herokuapp.com fwd="78.154.136.249" dyno=web.1 connect=0ms service=8ms status=200 bytes=0

我被这篇帖子评为Ruby on Rails App deployed to heroku showing "We're sorry, but something went wrong",但就我而言,这对我没有帮助=( 那么有人可以帮我解决我的问题吗?

UPD 1: 这是create_cart_items.rb代码:

class CreateCartItems < ActiveRecord::Migration
  def change
    create_table :cart_items do |t|
      t.column :book_id, :integer
      t.column :cart_id, :integer
      t.column :price, :float
      t.column :amount, :integer
      t.column :created_at, :datetime
    end
  end
end

UPD 2 :这是db:migrate trace:

Running `rake db:migrate --trace` attached to terminal... up, run.7697
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
Connecting to database specified by DATABASE_URL
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
Migrating to CreateAuthors (20130302171259)
Migrating to CreatePublishers (20130302185948)
Migrating to CreateBooksAndAuthorsBooks (20130302195412)
==  CreateBooksAndAuthorsBooks: migrating =====================================
-- create_table(:books)
NOTICE:  CREATE TABLE will create implicit sequence "books_id_seq" for serial column "books.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "books_pkey" for table "books"
   -> 0.0557s
-- create_table(:authors_books, {:id=>false})
   -> 0.0031s
-- Adding foreign keys
-- execute("CREATE TRIGGER fk_bk_authors BEFORE DELETE ON authors FOR EACH ROW BEGIN DELETE FROM authors_books WHERE author_id = OLD.id; END")
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  syntax error at or near "BEGIN"
LINE 1: ..._bk_authors BEFORE DELETE ON authors FOR EACH ROW BEGIN DELE...
                                                             ^
: CREATE TRIGGER fk_bk_authors BEFORE DELETE ON authors FOR EACH ROW BEGIN DELETE FROM authors_books WHERE author_id = OLD.id; END/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:652:in `exec'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:652:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:466:in `block in method_missing'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:438:in `block in say_with_time'
/usr/local/lib/ruby/1.9.1/benchmark.rb:295:in `measure'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:438:in `say_with_time'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:458:in `method_missing'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:334:in `method_missing'
/app/db/migrate/20130302195412_create_books_and_authors_books.rb:20:in `block in up'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:438:in `block in say_with_time'
/usr/local/lib/ruby/1.9.1/benchmark.rb:295:in `measure'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:438:in `say_with_time'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:334:in `method_missing'
/app/db/migrate/20130302195412_create_books_and_authors_books.rb:15:in `up'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:370:in `up'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:410:in `block (2 levels) in migrate'
/usr/local/lib/ruby/1.9.1/benchmark.rb:295:in `measure'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:410:in `block in migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:389:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:528:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/transactions.rb:208:in `transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `ddl_transaction'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:719:in `block in migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:700:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:700:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:570:in `up'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/migration.rb:551:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/railties/databases.rake:179:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate

UPD3 :application_controller.rb代码:

class ApplicationController < ActionController::Base
  before_filter :set_locale
  helper :all # include all helpers, all the time
  protect_from_forgery :only => [:create, :update, :destroy]
  private
  def set_locale
    accept_lang = request.env['HTTP_ACCEPT_LANGUAGE']
    accept_lang = accept_lang.blank? ? nil : accept_lang[/[^,;]+/]
    locale = params[:locale] || session[:locale] || accept_lang ||DEFAULT_LOCALE
    begin
      I18n.locale = locale
      session[:locale] = locale
    rescue
          I18n.locale = DEFAULT_LOCALE
    end
  end
  def initialize_cart
    if session[:cart_id] and Cart.exists?(session[:cart_id])
      @cart = Cart.find(session[:cart_id])
    else
      @cart = Cart.create
      session[:cart_id] = @cart.id
    end
  end
end

1 个答案:

答案 0 :(得分:1)

要点:

执行heroku run rake db:migrate

详细信息:

看起来推车表不存在。

请显示创建它的rails迁移。

您确定迁移是否已在Heroku上运行,而不仅仅是在本地?

如果你做了heroku run rake db:migrate你会得到什么?