Stephen Lee
Stephen Lee

Reputation: 327

application error on the web after you git push to Heroku

Basically, after I git push to Heroku, my website throws an error called

Application Error: An error occurred in the application and your page

could not be served. If you are the application owner,

check your logs for details.

But when I refresh the page, my website loads succesfully... Why?

For your information, I am running Hobbyist Dyno on Heroku with Rails

HERE IS THE LOG:

git push staging master
heroku logs -t --remote staging



2017-01-10T19:07:34.332770+00:00 app[api]: Release v54 created by user [email protected]
2017-01-10T19:07:35.190813+00:00 heroku[web.1]: Restarting
2017-01-10T19:07:35.191331+00:00 heroku[web.1]: State changed from up to starting
2017-01-10T19:07:35.233553+00:00 heroku[worker.1]: Restarting
2017-01-10T19:07:35.234020+00:00 heroku[worker.1]: State changed from up to starting
2017-01-10T19:07:35.995721+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-01-10T19:07:36.104550+00:00 heroku[worker.1]: Stopping all processes with SIGTERM


> 2017-01-10T19:07:36.082662+00:00 app[web.1]: [4] - Gracefully shutting down workers...
> 2017-01-10T19:07:36.121359+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Shutting down
> 2017-01-10T19:07:36.121553+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Terminating quiet workers
> 2017-01-10T19:07:36.122499+00:00 app[worker.1]: 4 TID-ow39cbrbg INFO: Scheduler exiting...
> 2017-01-10T19:07:36.623708+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Pausing to allow workers to finish...

> 2017-01-10T19:07:37.504392+00:00 app[web.1]: [4] === puma shutdown: 2017-01-10 19:07:37 +0000 ===

> 2017-01-10T19:07:37.504408+00:00 app[web.1]: [4] - Goodbye!
> 2017-01-10T19:07:37.800069+00:00 heroku[web.1]: Process exited with status 0
> 2017-01-10T19:07:38.127333+00:00 app[worker.1]: 4 TID-ow38ibptk INFO: Bye!
> 2017-01-10T19:07:38.345364+00:00 heroku[worker.1]: Process exited with status 0
> 2017-01-10T19:07:42.226982+00:00 heroku[web.1]: Starting process with command 

Upvotes: 1

Views: 144

Answers (2)

Stephen Lee
Stephen Lee

Reputation: 327

I found out that the problem was from my production.rb configurations. I used New Relic APM to help me narrow down which causes the timeout. Found out that it wasn't my middleware or backend. It was basically my assets pipeline problem.

production.rb

config.assets.debug = true #I was setting it to true..
config.assets.debug = false #<- fixes the issue... Plus, I was putting unnecessary js codes in my application.html.erb

Lessions learned...

I got to learn a lot about Sidekiq and thought it caused the problem lol and definitely New Relic APM is awesome in tracking which part of your code causes the timeout issue. In addition, try not to put too much js codes in one page...

Upvotes: 1

puneet18
puneet18

Reputation: 4427

Follow below steps to resolve issues:

  1. Test your site in local machine first, both in development and in production mode.
  2. Run any pending migration on heroku by command: heroku run rake db:migrate
  3. open heroku console and show logs in real time by command: heroku logs -t and hit the heroku link then you will display error logs.

Upvotes: 0

Related Questions