UPDATE - SOLVED: Both my local server and heroku wouldn't work. Two main components fixed this problem.
Thank you everyone for your help and support! Knowing that there are people out there willing to help is invaluable in this learning process; hence, my effort to document this error/solution for future coders to bang their heads a little less.
:( My app was working locally and then I followed the directions to push onto Heroku.
I got Heroku's super descriptive and comforting error message: "We're sorry, but something went wrong."
In other words, now my app doesn't work locally or on heroku... would love to solve this with your help. Thank you.
So I tried some things (in this order):
- I took out
gem 'sqlite3'
and replaced it withgem 'pg'
- In my gemfile, included
ruby '2.0.0'
- heroku rake db:migrate
I tried solving the local problem first.
When I tried rails server (to test locally), I got the following error:
Somehow when deploying to Heroku, there was inconsistency with my Ruby version, using 2.0.0 and gemfile was expected 1.8.
ms.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
Davids-MacBook-Air-6:portfolio davidngo$ rails server
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
What solved it for me:
- reinstalled my ruby 2.0.0 by running
rvm reinstall ruby 2.0.0
- run
bundle install
#=> when I saw "Your Ruby version is 2.0.0, but your Gemfile specified 1.8" I knew that I was in the right direction because this error is super common/all over StackOverFlow
The Main Heroku Problem:
State changed from starting to complete
2013-08-20T03:29:43.118968+00:00 heroku[run.2135]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
2013-08-20T03:29:43.119187+00:00 heroku[run.2135]: Stopping process with SIGKILL
2013-08-20T03:31:00.784270+00:00 heroku[router]: at=info method=GET path=/ host=shrouded-citadel-6554.herokuapp.com fwd="107.193.213.240" dyno=web.1 connect=2ms service=24ms status=500 bytes=643
2013-08-20T03:31:00.800238+00:00 app[web.1]:
2013-08-20T03:31:00.800238+00:00 app[web.1]: Started GET "/" for 107.193.213.240 at 2013-08-20 03:31:00 +0000
2013-08-20T03:31:00.800238+00:00 app[web.1]:
2013-08-20T03:31:00.802209+00:00 app[web.1]: Processing by CollectionsController#index as HTML
2013-08-20T03:31:00.808688+00:00 app[web.1]: Completed 500 Internal Server Error in 6ms
2013-08-20T03:31:00.810234+00:00 app[web.1]:
2013-08-20T03:31:00.810234+00:00 app[web.1]: WHERE a.attrelid = '"collections"'::regclass
2013-08-20T03:31:00.810234+00:00 app[web.1]: ^
2013-08-20T03:31:00.810234+00:00 app[web.1]: LINE 4: WHERE a.attrelid = '"collections"'::regclass
2013-08-20T03:31:00.810234+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2013-08-20T03:31:00.810234+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-08-20T03:31:00.810234+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "collections" does not exist
2013-08-20T03:31:00.810234+00:00 app[web.1]: ORDER BY a.attnum
2013-08-20T03:31:00.810234+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-08-20T03:31:00.810234+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
2013-08-20T03:31:00.810392+00:00 app[web.1]: ):
2013-08-20T03:31:00.810392+00:00 app[web.1]: app/controllers/collections_controller.rb:4:in `index'
2013-08-20T03:31:00.810392+00:00 app[web.1]:
2013-08-20T03:31:00.810392+00:00 app[web.1]:
2013-08-20T03:31:01.224316+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=shrouded-citadel-6554.herokuapp.com fwd="107.193.213.240" dyno=web.1 connect=3ms service=8ms status=200 bytes=0
What solved it for me:
heroku pg:reset DATABASE --confirm YOUR_APP_NAME
heroku run rake db:setup
heroku restart
heroku open
- Similar error in this thread: Heroku Postgres Error: PGError: ERROR: relation "organizations" does not exist (ActiveRecord::StatementInvalid)
- Related thread that may be helpful: How to empty DB in heroku (emptying database, seeding data, etc)
Related & Important Files:
In database.yml: development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: postgresql
encoding: utf8
database: portfolio_production
pool: 5
username:
password:
In Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '3.2.3'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end