Welcome Guest | Login

500 Error - Internal Server Error



This is a wiki article created by HostingRails users. Please login or signup to make edits.


This thread is devoted to help those of you who may be seeing a 500 error and wish to make it go away.



You are seeing this error because requests are hitting your dispatchers or environemnt.rb and becoming deathly ill.
 
Possible reasons (and solutions) for this error are:
  • Incorrect Shebang line in your dispatchers - often times if you upload your whole app from a development box to production servers (NOT RECOMMENDED), the shebang line  (e.g. #!/usr/local/bin/ruby ) at the top of your dispatch.fcgi and/or dispatch.rb are incorrect.  To determine what is the correct shebang line of your server, perform a:
    [~]# rails sbtest 
    and take a look at what is generated in ~/sbtest/public/dispatch.rb -- that is your correct shebang line.  

  • RAILS_GEM_VERSION discrepancies - In Rails 1.1.2 the following line is added to your enviornment.rb:
    RAILS_GEM_VERSION = '1.1.2'
    However, this is VERY often a cause of error because the rails version of the development box can be different than the rails version of the production box.  Check your rails version via 'rails -v' at the command line.

    Thus, you should ALWAYS install and freeze your own RubyGems so that if the Rails version of your production box ever changes, your app doesn't crash.  This happened like crazy when Rails 1.1.0 came out in late March 2006.    

  • Custom Gem and/or Plugin Issues - while often an error is reported in the logs, sometimes if you don't have your custom gem or plugin unpacked into your vendor folder (click here to learn how to do this[/url) you'll get a 500 error.  
     
  • Incorrect Permissions - sometimes a 403 will NOT be thrown and a permissions issue will haunt a request later during its path into your app.  Visit this page to see what your correct permissions should be.  

  • Has anyone seen other reasons for a 500 error in Rails?


If you're still having trouble, please feel free to ask a question in our deployment troubleshooting forum and/or update the content here for the next developer.


"

RESTful Rails Routes

If you're trying to deploy a RESTful rails application and are getting errors with your routing, here's the solution:

SSH to your server. From the home location.
cd yourappname

Then enter the following:
rake routes > routes.txt
This will create a file called routes.txt at the base of your application. This lists all the routes for your application on the hostingrails server. Most likely your routes are named differently than what you see here. It's a hassle but you need to change them to match up to this and it works fine.




Hello Guest! In order to edit this article you must be an active client with us, please log in or sign up today!






Contributing Author(s):
William
Zach