Trying to figure out why my rails app crashes in heroku?


Keywords:ruby  on  rails 


Question: 

I am brand new to heroku, trying to deploy a Rails app for the first time. When I open it, it crashes. Here is the logs, just wondering if anybody can make sense of it?

 018-02-28T03:49:38.908155+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
2018-02-28T03:49:38.908156+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
2018-02-28T03:49:38.908160+00:00 app[web.1]:    from bin/rails:9:in `require'
2018-02-28T03:49:38.917703+00:00 app[web.1]: => Booting Puma
2018-02-28T03:49:38.908161+00:00 app[web.1]:    from bin/rails:9:in `<main>'
2018-02-28T03:49:38.908153+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2018-02-28T03:49:38.917707+00:00 app[web.1]: => Rails 5.1.4 application starting in production 
2018-02-28T03:49:38.917709+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-28T03:49:38.917710+00:00 app[web.1]: Exiting
2018-02-28T03:50:00.911567+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=d5674160-7991-4e20-a8c2-9037cd14fca0 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:50:02.294872+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=5aac6d0b-2974-40ac-8fc3-fd314fcedba2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2018-02-28T03:49:38.908155+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
2018-02-28T03:49:38.908156+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
2018-02-28T03:49:38.908160+00:00 app[web.1]:    from bin/rails:9:in `require'
2018-02-28T03:49:38.917703+00:00 app[web.1]: => Booting Puma
2018-02-28T03:49:38.908161+00:00 app[web.1]:    from bin/rails:9:in `<main>'
2018-02-28T03:49:38.908153+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2018-02-28T03:49:38.917707+00:00 app[web.1]: => Rails 5.1.4 application starting in production 
2018-02-28T03:49:38.917709+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-28T03:49:38.917710+00:00 app[web.1]: Exiting
2018-02-28T03:50:00.911567+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=d5
674160-7991-4e20-a8c2-9037cd14fca0 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:50:02.294872+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=5aac6d0b-2974-40ac-8fc3-fd314fcedba2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2018-02-28T03:49:38.908155+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
2018-02-28T03:49:38.908156+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
2018-02-28T03:49:38.908160+00:00 app[web.1]:    from bin/rails:9:in `require'
2018-02-28T03:49:38.917703+00:00 app[web.1]: => Booting Puma
2018-02-28T03:49:38.908161+00:00 app[web.1]:    from bin/rails:9:in `<main>'
2018-02-28T03:49:38.908153+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2018-02-28T03:49:38.917707+00:00 app[web.1]: => Rails 5.1.4 application starting in production 
2018-02-28T03:49:38.917709+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-28T03:49:38.917710+00:00 app[web.1]: Exiting
2018-02-28T03:50:00.911567+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=d5
674160-7991-4e20-a8c2-9037cd14fca0 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:50:02.294872+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=5aac6d0b-2974-40ac-8fc3-fd314fcedba2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:52:46.845758+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=f695bff2-745d-4f14-af52-55b246316e7a fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:52:50.098411+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=b7af71af-e036-47b3-8c35-d9f841971cd2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2018-02-28T03:49:38.908160+00:00 app[web.1]:    from bin/rails:9:in `require'
2018-02-28T03:49:38.917703+00:00 app[web.1]: => Booting Puma
2018-02-28T03:49:38.908161+00:00 app[web.1]:    from bin/rails:9:in `<main>'
2018-02-28T03:49:38.908153+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2018-02-28T03:49:38.917707+00:00 app[web.1]: => Rails 5.1.4 application starting in production 
2018-02-28T03:49:38.917709+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-28T03:49:38.917710+00:00 app[web.1]: Exiting
2018-02-28T03:50:00.911567+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=d5674160-7991-4e20-a8c2-9037cd14fca0 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:50:02.294872+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=5aac6d0b-2974-40ac-8fc3-fd314fcedba2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:52:46.845758+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=f695bff2-745d-4f14-af52-55b246316e7a fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:52:50.098411+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=b7af71af-e036-47b3-8c35-d9f841971cd2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2018-02-28T03:49:38.908160+00:00 app[web.1]:    from bin/rails:9:in `require'
2018-02-28T03:49:38.917703+00:00 app[web.1]: => Booting Puma
2018-02-28T03:49:38.908161+00:00 app[web.1]:    from bin/rails:9:in `<main>'
2018-02-28T03:49:38.908153+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2018-02-28T03:49:38.917707+00:00 app[web.1]: => Rails 5.1.4 application starting in production 
2018-02-28T03:49:38.917709+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-28T03:49:38.917710+00:00 app[web.1]: Exiting
2018-02-28T03:50:00.911567+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=d5674160-7991-4e20-a8c2-9037cd14fca0 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:50:02.294872+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=5aac6d0b-2974-40ac-8fc3-fd314fcedba2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:52:46.845758+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fidirect-api.herokuapp.com request_id=f695bff2-745d-4f14-af52-55b246316e7a fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https
2018-02-28T03:52:50.098411+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fidirect-api.herokuapp.com request_id=b7af71af-e036-47b3-8c35-d9f841971cd2 fwd="199.116.73.196" dyno= connect= service= status=503 bytes= protocol=https

1 Answer: 

You need to install postgres locally because without postgres you can't install pg gem. So after installing postgres install pg gem so bundler made entries in your Gemfile.lock. Issue with heroku is that all gems must be installed locally before you deployed to heroku, because heroku reads your Gemfile.lock file to install dependencies.