I have a Rails app on Heroku that is serving 500 errors at random intervals. Web pages will display "Internal server error" in plain text, instead of the usual "We're sorry. Something went wrong." page. When I refresh the page, it works fine.
The logs don't show me an error message, just
» 14:20:34.107 2013-10-11 12:20:33.763690+00:00 heroku router - - at=info method=HEAD path=/ host=www.mydomain.com fwd="184.73.237.85/ec2-184-73-237-85.compute-1.amazonaws.com" dyno=web.1 connect=1ms service=63ms status=200 bytes=0 » 14:21:03.957 2013-10-11 12:21:03.561867+00:00 heroku router - - at=info method=GET path=/ host=www.mydomain.com fwd="50.112.95.211/ec2-50-112-95-211.us-west-2.compute.amazonaws.com" dyno=web.1 connect=0ms service=1ms status=500 bytes=21
Support has told me to look at request queuing in New Relic, but New Relic only shows a big red mark saying the server is down (even though the site works fine when refreshed).
With no error messages, I'm at a loss for how to diagnose this issue.
If you find an error message that you don't understand, try checking out the following resources: Heroku Error Codes (H12, R14, R15, H10, H14 etc.) - https://devcenter.heroku.com/articles/error-codes. Postgres Errors - https://devcenter.heroku.com/articles/postgres-logs-errors.
The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.
The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the website's server, but the server could not be more specific on what the exact problem is.
Try adding the rails_12factor
gem to get a more robust error log ( only if you're using Heroku ).
Make sure you rake db:migrate
your database on Heroku with heroku run rake db:migrate
In Heroku, I diagnose errors with LogEntries -- its far easier than the Heroku logs to diagnose errors.
What I do is load up the app, and in the LogEntries panel, go to "Live (Beta)". This shows any errors which appear, and are generally very explanatory
Just something that might help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With