Heroku应用程序错误:了解日志

时间:2013-05-10 17:28:09

标签: ruby-on-rails ruby-on-rails-3 heroku

我刚把我的rails应用程序推到了Heroku。然后我运行heroku db:migrate然后heroku db:push。但是当我打开应用程序时,我收到错误“应用程序中发生错误,无法提供您的页面。请稍后再试。如果您是应用程序所有者,请查看日志以获取详细信息”。

所以我运行了heroku日志,这就是我得到的:

$ heroku logs
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2013-05-10T17:13:21.460325+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': /app/app/controllers/users_controller.rb:54: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
2013-05-10T17:13:21.460325+00:00 app[web.1]:         redirect_to signin_url, notice: t "user.please"
2013-05-10T17:13:21.460325+00:00 app[web.1]:         ^
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
2013-05-10T17:13:21.460325+00:00 app[web.1]: Exiting
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:313:in `depend_on'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:225:in `require_dependency'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
2013-05-10T17:13:21.460654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `each'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:359:in `require_
or_load'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'

2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
2013-05-10T17:13:21.461416+00:00 app[web.1]:    from script/rails:6:in `require'

2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:in `new'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2013-05-10T17:13:21.461171+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config/environment.rb:
5:in `<top (required)>'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:3:in `requir
e'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/config.ru:3:in `block
in <main>'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-05-10T17:13:21.460896+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-05-10T17:13:21.460325+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'

2013-05-10T17:13:21.461416+00:00 app[web.1]:    from script/rails:6:in `<main>'
2013-05-10T17:13:23.235761+00:00 heroku[web.1]: State changed from starting to c
rashed
2013-05-10T17:13:23.221686+00:00 heroku[web.1]: Process exited with status 1
2013-05-10T17:13:23.237632+00:00 heroku[web.1]: State changed from crashed to st
arting
2013-05-10T17:13:24.507187+00:00 heroku[web.1]: Starting process with command `b
undle exec rails server -p 10305`
2013-05-10T17:13:27.937367+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-h
as-been-released. (called from <top (required)> at /app/config/environment.rb:5)

2013-05-10T17:13:27.935835+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-h
as-been-released. (called from <top (required)> at /app/config/environment.rb:5)

2013-05-10T17:13:27.938348+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-h
as-been-released. (called from <top (required)> at /app/config/environment.rb:5)

2013-05-10T17:13:31.274313+00:00 app[web.1]: => Booting WEBrick
2013-05-10T17:13:31.274313+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-05-10T17:13:31.274313+00:00 app[web.1]: => Call with -d to detach
2013-05-10T17:13:31.274313+00:00 app[web.1]: => Rails 3.2.12 application startin
g in production on http://0.0.0.0:10305
2013-05-10T17:13:31.274313+00:00 app[web.1]: Connecting to database specified by
 DATABASE_URL
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/application/finisher.rb:53:in `block in <modul
e:Finisher>'
2013-05-10T17:13:31.511810+00:00 app[web.1]:         redirect_to signin_url, not
ice: t "user.please"
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'

2013-05-10T17:13:31.511810+00:00 app[web.1]:
        ^
2013-05-10T17:13:31.511810+00:00 app[web.1]: Exiting
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:359:in `require_
or_load'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engin
e.rb:439:in `block (2 levels) in eager_load!'
2013-05-10T17:13:31.511810+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': /app/a
pp/controllers/users_controller.rb:54: syntax error, unexpected tSTRING_BEG, exp
ecting keyword_do or '{' or '(' (SyntaxError)
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'

2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:3:in `requir
e'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `block in eager_load!'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dep
endency'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in
 require'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:225:in `require_
dependency'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:436:in `eager_load!'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializ
ers'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config/environment.rb:
5:in `<top (required)>'
2013-05-10T17:13:31.511810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:313:in `depend_o
n'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:in `new'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-05-10T17:13:31.512991+00:00 app[web.1]:    from script/rails:6:in `<main>'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `each'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
2013-05-10T17:13:31.512991+00:00 app[web.1]:    from script/rails:6:in `require'

2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/engine.rb:436:in `each'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/config.ru:3:in `block
in <main>'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
2013-05-10T17:13:31.512180+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
2013-05-10T17:13:31.512434+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
2013-05-10T17:13:31.512702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/1.9
.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
2013-05-10T17:13:42.307007+00:00 heroku[web.1]: Process exited with status 1
2013-05-10T17:13:42.323377+00:00 heroku[web.1]: State changed from starting to c
rashed
2013-05-10T17:13:55.228036+00:00 heroku[api]: Starting process with command `bun
dle exec rake db:migrate` by muyiwamat@gmail.com
2013-05-10T17:13:57.306953+00:00 heroku[run.6043]: Awaiting client
2013-05-10T17:13:57.324094+00:00 heroku[run.6043]: Starting process with command
 `bundle exec rake db:migrate`
2013-05-10T17:13:58.232657+00:00 heroku[run.6043]: State changed from starting t
o up
2013-05-10T17:14:06.400819+00:00 heroku[run.6043]: Process exited with status 0
2013-05-10T17:14:06.419565+00:00 heroku[run.6043]: State changed from up to comp
lete
2013-05-10T17:17:30.518444+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path=/ host=immense-refuge-9281.herokuapp.com fwd="94.116.4.100
" dyno= connect= service= status=503 bytes=
2013-05-10T17:17:30.975159+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path=/favicon.ico host=immense-refuge-9281.herokuapp.com fwd="9
4.116.4.100" dyno= connect= service= status=503 bytes=

我几乎无法理解这些文件。有什么我可能做错了吗?我正在使用Rails 3.2,我已经确定我使用了heroku --stack cedar,因为我读到某个地方,heroku只支持雪松堆栈上的Rails 3。

- UPDATE-- 根据Leo Correa的要求,下面是我的users_controller.rb的片段

def signed_in_user
     unless signed_in?
        store_location
        redirect_to (signin_url, notice: t("user.please")) 
     end
    end

3 个答案:

答案 0 :(得分:3)

这似乎是一个语法错误,你可能会遗漏像花括号或括号

这样的东西
/app/app/controllers/users_controller.rb:54: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
2013-05-10T17:13:21.460325+00:00 app[web.1]:         redirect_to signin_url, notice: t "user.please"

那个大块就把它拿走了。所以在第54行的users_controller中的某处。尝试这样做

redirect_to(signing_url, notice: t('user.please'))

答案 1 :(得分:1)

我认为在预编译资产时你需要在config.assets.initialize_on_precompile = false中添加config/application.rb。如果已添加到config/environments/production.rb

从您的日志中看似语法错误如:

redirect_to(signing_url, notice: t('user.please'))

我认为您正在使用Devise Gem检查您的代码。

答案 2 :(得分:0)

您可以使用heroku的免费帐户。当您使用heroku的免费帐户时,您每天只能使用18个小时,然后自动进入睡眠状态或疲惫不堪。当它发生时你会得到这个错误页面。如果您的网站繁忙,请尝试跳过帐户到业余爱好类型。