title: PostgreSQL + Rails connection troubleshooting
body: <p>I've used this site a bunch over the past three years or so...this is my first post :D</p>
  
  <p>But enough of the useless banter and on to the business at hand.</p>
  
  <hr>
  
  <p>I will start with the approach/problem, the error, and then a trace/log of the error.</p>
  
  <p>Then I will go over what I've done so far to best this problem, some odd things I've noticed, and what I think might be causing it.</p>
  
  <hr>
  
  <p><strong>APPROACH/PROBLEM:</strong> </p>
  
  <p>I was recently added to the back-end development team for a mobile app, and before I implement any new features I have to get the product up and running on my local machine...</p>
  
  <p>(in app directory) rails s</p>
  
  <p>=> Booting WEBrick</p>
  
  <p>=> Rails 3.1.0.rc4 application starting in development on <a href="http://0.0.0.0:3000" rel="nofollow">http://0.0.0.0:3000</a></p>
  
  <p>=> Call with -d to detach
  => Ctrl-C to shutdown server</p>
  
  <p>[2011-09-14 19:11:59] INFO  WEBrick 1.3.1</p>
  
  <p>[2011-09-14 19:11:59] INFO  ruby 1.8.7 (2009-06-12) [universal-darwin10.0]</p>
  
  <p>[2011-09-14 19:11:59] INFO  WEBrick::HTTPServer#start: pid=35031 port=3000</p>
  
  <p>So all of this looks fine for now, but when I attempt to access the page on a browser...</p>
  
  <hr>
  
  <p><strong>ERROR:</strong></p>
  
  <p>(browser page title): Action Controller:Exception caught</p>
  
  <p>PGError</p>
  
  <p>fe_sendauth: no password supplied</p>
  
  <hr>
  
  <p><strong>TRACE/LOG</strong></p>
  
  <p>(continued from last line on terminal in the first section)</p>
  
  <p>cache error: No server available</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/dalli-1.0.5/lib/dalli/ring.rb:45:in `server_for_key'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/dalli-1.0.5/lib/dalli/client.rb:239:in `perform'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/dalli-1.0.5/lib/dalli/client.rb:60:in `get'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-cache-1.0.3/lib/rack/cache/metastore.rb:320:in `read'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-cache-1.0.3/lib/rack/cache/metastore.rb:30:in `lookup'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:165:in `lookup'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:65:in `call!'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-cache-1.0.3/lib/rack/cache/context.rb:50:in `call'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-1.3.2/lib/rack/deflater.rb:13:in `call'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/railties-3.1.0.rc4/lib/rails/rack/content_length.rb:16:in `call'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/railties-3.1.0.rc4/lib/rails/rack/log_tailer.rb:14:in `call'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-1.3.2/lib/rack/handler/webrick.rb:59:in `service'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'</p>
  
  <p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-1.3.2/lib/rack/handler/webrick.rb:13:in `run'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/rack-1.3.2/lib/rack/server.rb:265:in `start'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/railties-3.1.0.rc4/lib/rails/commands/server.rb:70:in `start'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/railties-3.1.0.rc4/lib/rails/commands.rb:54</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `tap'</p>
  
  <p>/Library/Ruby/Gems/1.8/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49</p>
  
  <p>script/rails:6:in `require'</p>
  
  <p>script/rails:6</p>
  
  <p>cache: [GET /] pass</p>
  
  <p>Dalli::Server#connect localhost:11211</p>
  
  <p>localhost:11211 failed (count: 0)</p>
  
  <p>I can give out the full trace from the browser as well, but I don't want this post to get TOO wordy.</p>
  
  <p>So this is the dilemma!</p>
  
  <hr>
  
  <p><strong>What I've Done:</strong></p>
  
  <p>The simple solutions(listed below) haven't made any difference.</p>
  
  <p>The pg gem installed correctly(after including the path manually)</p>
  
  <p>I fixed the pg_hba.conf file to allow trust(ed) connections.</p>
  
  <p>I can connect to a postgres db through the pgadmin3 tool and through the terminal.</p>
  
  <hr>
  
  <p><strong>Huh?:</strong></p>
  
  <p>Running the server on a different port doesn't make any difference, although if I try to connect to one of the ports reserved for my postgresql db, the connection is busy(I can post that error log as well, if needed).</p>
  
  <p>If I try to access a non-existent page from the app...like users/explode or signin/signout, the error is the same. The terminal log does show the " [GET /'var'] pass " each time, though.</p>
  
  <hr>
  
  <p><strong>Thoughts:</strong></p>
  
  <p>My best guess is that the problem is from the connection still expecting a password, since there is a pass - word at the end of " [GET /'var'] pass "</p>
  
  <p>OR</p>
  
  <p>That the pg db is being run on a different server and the app doesn't like me trying to run it on my local machine.</p>
  
  <p>I'm hoping your guess is better than mine.</p>
  
  <hr>
  
  <p>If you managed to make it though this post, kudos. It's greatly appreciated. 
  If you manage to come up with a solution, somehow, I will be eternally gracious.</p>
  
  <p>Regards,</p>
  
  <p>~Ryan Johnson(RyeGuyHead)</p>