我已将我的Rails 3应用程序推送到Heroku但是当我尝试在浏览器中打开它时,我得到了一个"应用程序错误。"
运行' heroku日志'返回以下内容:
2014-05-12T17:19:12.592829+00:00 heroku[router]: at=error code=H10 desc="App crashed"
method=GET path=/ host=mycfi.herokuapp.com request_id=a486e0ad-450e-4fa0-8546-
33e9d76e171d fwd="208.191.153.66" dyno= connect= service= status=503 bytes=
2014-05-12T17:19:13.127416+00:00 heroku[router]: at=error code=H10 desc="App crashed"
method=GET path=/favicon.ico host=mycfi.herokuapp.com request_id=ba155c24-eadd-407c-
abf1-0e805fa17f82 fwd="208.191.153.66" dyno= connect= service= status=503 bytes=
运行' heroku运行包exec rails console"返回以下内容:
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)
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)
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-
3.2.13/lib/active_support/dependencies.rb:251:in `require':
/app/app/controllers/stripe_events_controller.rb:27: syntax error, unexpected
keyword_end (SyntaxError)
/app/app/controllers/stripe_events_controller.rb:46: syntax error, unexpected $end,
expecting keyword_end
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in `require_or_load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:313:in `depend_on'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `block in eager_load!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `eager_load!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /app/config/environment.rb:5:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
你认为会有一个明显的结局&#39;导致此错误的地方,但我确信情况并非如此。错误所指的代码行之前已经有效,所以我不确定发生了什么。
非常感谢任何帮助!感谢。
编辑1:这里引用了我的stripe_events_controller中的代码。注意我不小心留下的逗号(在评论之前)。吉兹!
def parse_and_validate_event
@event = StripeEvent.new(event_id: params[:id], event_type: params[:type])
unless @event.save # attempts to save to db
if @event.valid? # checks to see if unique
render nothing: true, status: 400 # valid event, try again later
else
render nothing: true, # invalid event, move along
end
end
end
答案 0 :(得分:0)
错误很明显:
/app/app/controllers/stripe_events_controller.rb:46: syntax error, unexpected $end,
expecting keyword_end
也许您的代码尚未提交源代码控制并被推送?这不是Heroku的错误。