3

This is driving me nuts. There is no error in development environment. There was no error in production environment when I deployed to Amazon EC2.

However, on Heroku, it is giving me a 500 error when accessing a particular page. There is no other message than 500 error message.

2012-10-09T06:50:02+00:00 app[web.1]: Completed 500 Internal Server Error in 72ms (Views: 11.5ms | ActiveRecord: 44.2ms)

That's all I have. No other error message. I even set the logging level to "DEBUG".

What can I do to find out what's causing the 500 error on Heroku?

I appreciate your help.

4

2 回答 2

2

Have you checked your assets are being precompiled on deploy to Heroku? A broken asset pipeline can create 500 errors with little logged explanation at runtime.

于 2012-10-09T07:38:41.970 回答
2

It turned out to be nothing to do with sass. I had to catch 500 error and display stack trace to figure out exactly what was causing the error and fix it.

In the helper function, I had

rand(1..size)

and that was causing the error on Heroku, but not on development environment nor on EC2. I had to modify it to

rand(size)

and that fixed it.

After printing stack trace, it was easy to pinpoint what was causing the error.

I wrote a blog post about catching 400 and 500 errors so that you can do more interesting things.

http://blog.yangtheman.com/2012/10/11/user-friendly-500-and-404-pages-on-rails-3/

于 2012-10-16T05:27:58.080 回答