简体   繁体   中英

Rails 3 “Application Error” when deploying to Heroku

I have pushed my Rails 3 app to Heroku but when I attempt to open it in the browser I get an "Application Error."

Running 'heroku logs' returns the following:

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=

Running 'heroku run bundle exec rails console" returns the following:

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>'

You'd think there would be an obvious 'end' somewhere that is causing this error but I am certain that this is not the case. The lines of code that the error is referring to has worked before, so I am not sure what happened.

Any help is greatly appreciated! Thanks.

Edit 1: Here is referred to code from my stripe_events_controller. Notice the comma that I accidentally left in (right before the comment). Geez!

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

The error is clear:

/app/app/controllers/stripe_events_controller.rb:46: syntax error, unexpected $end,
expecting keyword_end

Perhaps your code has not been committed to source control and pushed? This is not an error on Heroku.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM