ruby-on-rails - Heroku 应用程序错误 : understanding the logs

标签 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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92ffe7ebfbe5f3fff3e6d2f5fff3fbfebcf1fdff" rel="noreferrer noopener nofollow">[email protected]</a>
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 仅支持 cedar 堆栈上的 Rails 3。

--更新-- 按照 Leo Correa 的要求,下面是我的 users_controller.rb 的片段

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

最佳答案

这似乎是一个语法错误,您可能会丢失诸如大括号或括号之类的内容

/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"

那 block 东西泄露了。所以在你的 users_controller 的第 54 行的某个地方。尝试这样做

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

关于ruby-on-rails - Heroku 应用程序错误 : understanding the logs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16487763/

相关文章:

ruby-on-rails - 无法在 Webpacker 中的 vuex 突变测试中导入 vue.esm.js

ruby-on-rails - ruby on Rails 应用程序重新启动时执行脚本

ruby-on-rails-3 - jquery-ujs ajax 事件不被处理

javascript - 填写 PDF 表格

ruby-on-rails - Rails 请求覆盖参数

ruby-on-rails - Rails 搜索插件和解决方案

ruby-on-rails - Rails 日志中的缩进

ruby-on-rails - Rails 自动转义 HTML - 如何阻止它?

heroku - heroku 日志中的 fwd 是什么意思?

node.js - 如何将git hash添加到Vue.js组件