开发者

Why am I getting this Heroku and Rails error?

开发者 https://www.devze.com 2023-04-03 02:29 出处:网络
I am trying to deploy my Rails web application on Heroku. I used scaffold to generate two tables. On my machine it all works perfect using SQLite.

I am trying to deploy my Rails web application on Heroku. I used scaffold to generate two tables. On my machine it all works perfect using SQLite.

I uploaded my app to heroku and now have a weird problem. When I use:

heroku config:add RACK_ENV=development

it works with SQL tables. When I change it back to production it shows:

We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

I typed in the terminal:

heroku logs

Output:

2011-09-07T13:44:31+00:00 app[web.1]: >> Maximum connections set to 1024
2011-09-07T13:44:31+00:00 app[web.1]: >> Listening on 0.0.0.0:16691, CTRL+C to stop
2011-09-07T13:44:31+00:00 heroku[web.1]: State changed from starting to up
2011-09-07T13:44:32+00:00 app[web.1]: cache: [GET /users] miss
2011-09-07T13:44:32+00:00 heroku[router]: GET falling-winter-505.heroku.com/users dyno=web.1 queue=0 wait=0ms service=193ms status=500 bytes=728
2011-09-07T13:44:47+00:00 app[web.1]: >> Stopping ...
2011-09-07T13:56:25+00:00 app[web.1]: cache: [GET /users] miss
2011-09-07T13:56:25+00:00 heroku[router]: GET falling-winter-505.heroku.com/users dyno=web.1 queue=0 wait=0ms service=26ms status=500 bytes=728
2011-09-07T13:56:25+00:00 heroku[nginx]: 95.26.72.50 - - [07/Sep/2011:06:56:25 -0700] "GET /users HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2" falling-winter-505.heroku.com
2011-09-07T15:00:53+00:00 heroku[web.1]: Idling
2011-09-07T15:00:54+00:00 heroku[web.1]: State changed from up to down
2011-09-07T15:00:54+00:00 heroku[web.1]: State changed from down to created
2011-09-07T15:00:54+00:00 heroku[web.1]: State changed from created to starting
2011-09-07T15:00:55+00:00 heroku[web.1]: Stopping process with SIGTERM
2011-09-07T15:00:55+00:00 app[web.1]: >> Stopping ...
2011-09-07T15:00:55+00:00 heroku[web.1]: Process exited
2011-09-07T15:00:59+00:00 heroku[web.1]: Starting process with command `thin -p 8370 -e production -R /home/heroku_rack/heroku.ru start`
2011-09-07T15:01:03+00:00 app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
2011-09-07T15:01:03+00:00 app[web.1]: >> Maximum connections set to 1024
2011-09-07T15:01:03+00:00 app[web.1]: >> Listening on 0.0.0.0:8370, CTRL+C to stop
2011-09-07T15:01:04+00:00 heroku[web.1]: State changed from starting to up
2011-09-07T16:07:12+00:00 heroku[web.1]: State changed from up to down
2011-09-07T16:07:13+00:00 heroku[web.1]: Stopping process with SIGTERM
2011-09-07T16:07:13+00:00 app[web.1]: >> Stopping ...
2011-09-07T16:07:14+00:00 heroku[web.1]: Process exited 
2011-09-07T17:10:28+00:00 heroku[web.1]: Unidling
2011-09-07T17:10:28+00:00 heroku[web.1]: State changed from down to created
2011-09-07T17:10:28+00:00 heroku[web.1]: State changed from created to starting
2011-09-07T17:10:40+00:00 heroku[web.1]: Starting process with command `thin -p 35396 -e production -R /home/heroku_rack/heroku.ru start`
2011-09-07T17:10:44+00:00 app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
2011-09-07T17:10:44+00:00 app[web.1]: >> Maximum connections set to 1024
2011-09-07T17:10:44+00:00 app[web.1]: >> Listening on 0.0.0.0:35396, CTRL+C to stop
2011-09-07T17:10:45+00:00 heroku[web.1]: State changed from starting to up
2011-09-07T17:10:46+00:00 app[web.1]: cache: [GET /users] miss
2011-09-07T17:10:46+00:00 heroku[router]: GET falling-winter-505.heroku.com/users dyno=web.1 queue=0 wait=7ms service=173ms status=500 bytes=728
2011-09-07T17:10:46+00:00 app[web.1]: cache: [GET /favicon.ico] miss, store
2011-09-07T17:10:46+00:00 heroku[router]: GET falling-winter-505.heroku.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=9ms status=200 bytes=0
2011-09-07T17:54:01+00:00 app[web.1]: cache: [GET /] miss
2011-09-07T17:54:01+00:00 heroku[router]: GET falling-winter-505.heroku.com/ dyno=web.1 queue=0 wait=0ms service=3ms status=200 bytes=5907
2011-09-07T17:54:01+00:00 heroku[nginx]: 95.26.190.212 - - [07/Sep/2011:10:54:01 -0700] "GET / HTTP/1.1" 200 1865 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2" falling-winter-505.heroku.com
2011-09-07T17:54:02+00:00 app[web.1]: cache: [GET /assets/rails.png] miss, store
2011-09-07T17:54:02+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/rails.png dyno=web.1 queue=0 wait=0ms service=12ms status=200 bytes=6646
2011-09-07T17:54:02+00:00 heroku[nginx]: 95.26.190.212 - - [07/Sep/2011:10:54:02 -0700] "GET /assets/rails.png HTTP/1.1" 200 6646 "http://falling-winter-505.heroku.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2" falling-winter-505.heroku.com
2011-09-07T17:54:09+00:00 app[web.1]: cache: [GET /users] miss
2011-09-07T17:54:09+00:00 heroku[router]: GET falling-winter-505.heroku.com/users dyno=web.1 queue=0 wait=0ms service=14ms status=500 bytes=728
2011-09-07T17:54:09+00:00 heroku[nginx]: 95.26.190.212 - - [07/Sep/2011:10:54:09 -0700] "GET /users HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2" falling-winter-505.heroku.com
2011-09-07T18:01:13+00:00 app[web.1]: cache: [GET /users] miss
2011-09-07T18:01:13+00:00 heroku[router]: GET falling-winter-505.heroku.com/users dyno=web.1 queue=0 wait=0ms service=30ms status=500 bytes=728
2011-09-07T18:01:13+00:00 heroku[nginx]: 95.26.190.212 - - [07/Sep/2011:11:01:13 -0700] "GET /users HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2" falling-winter-505.heroku.com
2011-09-07T18:03:29+00:00 app[web.1]: cache: [GET /users] miss
2011-09-07T18:03:29+00:00 heroku[router]: GET falling-winter-505.heroku.com/users dyno=web.1 queue=0 wait=0ms service=12ms status=500 bytes=728
2011-09-07T18:03:29+00:00 heroku[nginx]: 95.26.190.212 - - [07/Sep/2011:11:03:29 -0700] "GET /users HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2" falling-winter-505.heroku.com
2011-09-07T18:03:42+00:00 heroku[api]: Config add RACK_ENV by g...@gmail.com
2011-09-07T18:03:42+00:00 heroku[api]: Release v9 created by g...@gmail.com
2011-09-07T18:03:42+00:00 heroku[web.1]: State changed from up to bouncing
2011-09-07T18:03:42+00:00 heroku[web.1]: State changed from bouncing to created
2011-09-07T18:03:42+00:00 heroku[web.1]: State changed from created to starting
2011-09-07T18:03:44+00:00 heroku[web.1]: Stopping process with S

2011-09-07T18:03:44+00:00 app[web.1]: >> Stopping ...
2011-09-07T18:03:44+00:00 heroku[web.1]: Process exited
2011-09-07T18:03:46+00:00 heroku[web.1]: Starting process with command `thin -p 16194 -e development -R /home/heroku_rack/heroku.ru start`
2011-09-07T18:03:49+00:00 app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
2011-09-07T18:03:49+00:00 app[web.1]: >> Maximum connections set to 1024
2011-09-07T18:03:49+00:00 app[web.1]: >> Listening on 0.0.0.0:16194, CTRL+C to stop
2011-09-07T18:03:49+00:00 heroku[web.1]: State changed from starting to up
2011-09-07T18:03:52+00:00 heroku[router]: GET falling-winter-505.heroku.com/users dyno=web.1 queue=0 wait=0ms service=2057ms status=200 bytes=1677
2011-09-07T18:03:52+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/application.css dyno=web.1 queue=0 wait=0ms service=4ms status=200 bytes=314
2011-09-07T18:03:52+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/microposts.css dyno=web.1 queue=0 wait=0ms service=6ms status=200 bytes=0
2011-09-07T18:03:52+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/jquery_ujs.js dyno=web.1 queue=0 wait=0ms service=10ms status=200 bytes=13425
2011-09-07T18:03:53+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/jquery.js dyno=web.1 queue=0 wait=0ms service=26ms status=200 bytes=236203
2011-09-07T18:03:53+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/users.css dyno=web.1 queue=1 wait=30ms service=7ms status=200 bytes=0
2011-09-07T18:03:53+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/scaffolds.css dyno=web.1 queue=2 wait=40ms service=7ms status=200 bytes=1755
2011-09-07T18:03:53+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/application.js dyno=web.1 queue=0 wait=0ms service=8ms status=200 bytes=404
2011-09-07T18:03:53+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/users.js dyno=web.1 queue=0 wait=4ms service=7ms status=200 bytes=30
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/microposts dyno=web.1 queue=0 wait=0ms service=67ms status=200 bytes=1977
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/application.css dyno=web.1 queue=0 wait=0ms service=3ms status=200 bytes=314
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/scaffolds.css dyno=web.1 queue=0 wait=0ms service=2ms status=200 bytes=1755
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/users.css dyno=web.1 queue=0 wait=0ms service=3ms status=200 bytes=0
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/microposts.css dyno=web.1 queue=1 wait=1ms service=2ms status=200 bytes=0
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/microposts.js dyno=web.1 queue=0 wait=0ms service=4ms status=200 bytes=30
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/jquery.js dyno=web.1 queue=0 wait=0ms service=12ms status=200 bytes=236203
2011-09-07T18:04:08+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/jquery_ujs.js dyno=web.1 queue=0 wait=0ms service=8ms status=200 bytes=13425
2011-09-07T18:04:09+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/users.js dyno=web.1 queue=0 wait=0ms service=5ms status=200 bytes=30
2011-09-07T18:04:09+00:00 heroku[router]: GET falling-winter-505.heroku.com/assets/application.js dyno=web.1 queue=1 wait=4ms service=3ms status=200 bytes=404
2011-09-07T18:04:21+00:00 heroku[api]: Config add RACK_ENV by g...@gmail.com
2011-09-07T18:04:21+00:00 heroku[api]: Release v10 created by g...@gmail.com
2011-09-07T18:04:21+00:00 heroku[web.1]: State changed from up to bouncing
2011-09-07T18:04:21+00:00 heroku[web.1]: State changed from bouncing to created
2011-09-07T18:04:21+00:00 heroku[web.1]: State changed from created to starting
2011-09-07T18:04:23+00:00 heroku[web.1]: Stopping process with SIGTERM
2011-09-07T18:04:23+00:00 app[web.1]: >> Stopping ...
2011-09-07T18:04:23+00:00 heroku[web.1]: Process exited
2011-09-07T18:04:24+00:00 heroku[web.1]: Starting process with command `thin -p 30135 -e production -R /home/heroku_rack/heroku.ru start`
2011-09-07T18:04:28+00:00 app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
2011-09-07T18:04:28+00:00 app[web.1]: >> Maximum connections set to 1024
2011-09-07T18:04:28+00:00 app[web.1]: >> Listening on 0.0.0.0:30135, CTRL+C to stop
2011-09-07T18:04:29+00:00 heroku[web.1]: State changed from starting to up
2011-09-07T18:04:30+00:00 app[web.1]: cache: [GET /microposts] miss
2011-09-07T18:04:30+00:00 heroku[router]: GET falling-winter-505.heroku.com/microposts dyno=web.1 queue=0 wait=0ms service=164ms status=500 bytes=728
2011-09-07T18:04:30+00:00 heroku[nginx]: 95.26.190.212 - - [07/Sep/2011:11:04:30 -0700] "GET /microposts HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Macintosh;开发者_如何学Python Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2" falling-winter-505.heroku.com

My Version of Ruby is 1.9.2p290, and the version of Rails is 3.1.0.


Considering that it works in development mode but not production, I'd say the most likely culprit is your production.rb file as John Beynon suggested. The next thing I'd try is to run it in production mode locally. You should get, if nothing else, better error messages.


It appears you did not precompile your assets. Here is how to do it http://guides.rubyonrails.org/asset_pipeline.html#in-production


I know I had lots of troubles with that before. And it was an issue of Heroku not supporting sqlite3 at all. They remove your database.yml file with a new one, which uses mysql. A few things to check:

  • Add the mysql or mysql2 gem.
  • Does your app depend on data from the database? If so you'll need to find a way to import the new data into mysql as your sqlite databases won't work. I ended up using the yaml_db gem to do this (https://github.com/adamwiggins/yaml_db). And had to do some stuff with
0

精彩评论

暂无评论...
验证码 换一张
取 消