Rails app returns HTTP 500, but nothing shows up in log files

1,885 views
Skip to first unread message

Michael Dippery

unread,
Feb 25, 2010, 9:23:07 AM2/25/10
to techva...@googlegroups.com
Hey guys, I have a quick question for the group re: an app I am developing at work.

I have a Rails app that is running on a production server with Apache and Phusion Passenger. The app works fine locally (i.e., on my machine) when using Mongrel, but whenever I try to load a URL on the production server, it returns HTTP 500. I know the server is working properly, because I can get the static elements of the application (e.g., JavaScript files, stylesheets, images) just fine. I've also checked the Passenger status and it is loading the app (it must be, since the app's 500 Internal Server Error page is returned, not just the default Apache one). When I load the app via script/console production and do something like app.get("/"), 500 is also returned.

The problem is that there is nothing in the log files to indicate the problem. production.log is empty (and when I switch Passenger to use the development environment, development.log is empty, too). The Apache error logs show no problems with Apache, either. I'm stumped as to what's going on and I'm not sure how to diagnose the problem.

I know I may have been a bit vague, but can anyone give a suggestion on what the problem may be? Or at least a way I can go about diagnosing it?

Thanks,
----
Michael Dippery
mdip...@gmail.com | www.monkey-robot.com

Chris Holtz

unread,
Feb 25, 2010, 11:26:21 AM2/25/10
to TechValley Ruby Brigade
What happens if you ssh into the production server, cd into the app's
folder and try ruby script/server RAILS_ENV=production? Does the app
start without error? Once running, the console should output log
information ( the verbosity will vary depending on what version of
rails you're using ). If you visit's the production site's 3000 port
when you have rails running form the console, you may see log
information about the error from the console.

- Chris Holtz

> mdipp...@gmail.com |www.monkey-robot.com

JimCifarelli

unread,
Feb 26, 2010, 12:15:46 PM2/26/10
to TechValley Ruby Brigade
Hi Michael and Chris,

I'm in line with Chris's advice... but I'm wondering one thing....

When Michael ran "script/console production" on his server, would he
see the same loading errors (Ruby syntax/ Gem issues) as running
"script/server RAILS_ENV=production" ? (as the Rails environment is
loaded in both script/console and script/server")

-Jim

Michael Dippery

unread,
Feb 26, 2010, 8:24:38 PM2/26/10
to techva...@googlegroups.com
It starts without error, but when I fire up lynx and navigate to 0.0.0.0:3000, I still get a 500 Internal Server Error. No output on the console running script/server, though.

-- Michael

Michael Dippery

unread,
Feb 27, 2010, 8:14:07 PM2/27/10
to techva...@googlegroups.com
Ah, I solved the issue. The problem was that one of the model classes connected to another database, but this database was not configured properly. I imagine that the reason that nothing was written to the log files was that it happened fairly early on during app initialization, and Rails didn't get around to spitting out anything helpful. But who knows...


-- Michael

Reply all
Reply to author
Forward
0 new messages