简体   繁体   English

在Heroku上调试500错误,没有任何错误消息

[英]Debugging 500 error on Heroku without any error message

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. 部署到Amazon EC2时,生产环境中没有错误。

However, on Heroku, it is giving me a 500 error when accessing a particular page. 但是,在Heroku上,它在访问特定页面时给出了500错误。 There is no other message than 500 error message. 除了500错误消息之外没有其他消息。

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". 我甚至将日志记录级别设置为“DEBUG”。

What can I do to find out what's causing the 500 error on Heroku? 我该怎么做才能找出导致Heroku出现500错误的原因?

I appreciate your help. 我感谢您的帮助。

Have you checked your assets are being precompiled on deploy to Heroku? 您是否检查过您的资产是否在部署到Heroku时进行了预编译? A broken asset pipeline can create 500 errors with little logged explanation at runtime. 破坏的资产管道可以创建500个错误,在运行时几乎没有记录说明。

It turned out to be nothing to do with sass. 事实证明这与sass无关。 I had to catch 500 error and display stack trace to figure out exactly what was causing the error and fix it. 我不得不捕获500错误并显示堆栈跟踪以确切地找出导致错误的原因并修复它。

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. 这导致Heroku上的错误,但不是在开发环境和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. 我写了一篇关于捕获400和500错误的博客文章,以便您可以做更多有趣的事情。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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