如何检查Heroku的错误

时间:2017-03-10 22:06:55

标签: ruby-on-rails heroku

从Ruby on Rails推送到Heroku后,我的Web应用程序开放出现了问题。当我在cloud9 ide中测试我的应用程序时,它会打开并完美运行。然而,当我尝试在将所有分支合并到主服务器并将主服务器推送到git和Heroku之后打开它我得到了这个:

https://limitless-fortress-32820.herokuapp.com/

我不确定如何解决这个问题。有什么建议吗?

这就是日志所说的:

2017-03-11T02:43:48.982178+00:00 app[web.1]: D, [2017-03-11T02:43:48.982112 #4] DEBUG -- : [9828508f-52fc-489a-9bda-d680b05f1c28]   Plan Load (0.7ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
2017-03-11T02:43:48.983225+00:00 app[web.1]: D, [2017-03-11T02:43:48.983167 #4] DEBUG -- : [9828508f-52fc-489a-9bda-d680b05f1c28]   Plan Load (0.6ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 3], ["LIMIT", 1]]
2017-03-11T02:43:48.983770+00:00 app[web.1]: I, [2017-03-11T02:43:48.983713 #4]  INFO -- : [9828508f-52fc-489a-9bda-d680b05f1c28] Completed 404 Not Found in 3ms (ActiveRecord: 1.4ms)
2017-03-11T02:43:48.984196+00:00 app[web.1]: F, [2017-03-11T02:43:48.984142 #4] FATAL -- : [9828508f-52fc-489a-9bda-d680b05f1c28]   
2017-03-11T02:43:48.984248+00:00 app[web.1]: F, [2017-03-11T02:43:48.984196 #4] FATAL -- : [9828508f-52fc-489a-9bda-d680b05f1c28] ActiveRecord::RecordNotFound (Couldn't find Plan with 'id'=3):
2017-03-11T02:43:48.984296+00:00 app[web.1]: F, [2017-03-11T02:43:48.984249 #4] FATAL -- : [9828508f-52fc-489a-9bda-d680b05f1c28]   
2017-03-11T02:43:48.984347+00:00 app[web.1]: F, [2017-03-11T02:43:48.984296 #4] FATAL -- : [9828508f-52fc-489a-9bda-d680b05f1c28] app/controllers/pages_controller.rb:5:in `home'
2017-03-11T03:20:33.758477+00:00 heroku[web.1]: Idling
2017-03-11T03:20:33.759144+00:00 heroku[web.1]: State changed from up to down
2017-03-11T03:20:34.554844+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-03-11T03:20:34.566891+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2017-03-11T03:20:34.566983+00:00 app[web.1]: === puma shutdown: 2017-03-11 03:20:34 +0000 ===
2017-03-11T03:20:34.566987+00:00 app[web.1]: - Goodbye!
2017-03-11T03:20:34.567392+00:00 app[web.1]: Exiting
2017-03-11T03:20:34.775834+00:00 heroku[web.1]: Process exited with status 0
2017-03-11T05:25:57.075991+00:00 heroku[web.1]: Unidling
2017-03-11T05:25:57.076291+00:00 heroku[web.1]: State changed from down to starting
2017-03-11T05:26:01.138390+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 56896 -e production`
2017-03-11T05:26:06.849508+00:00 app[web.1]: => Booting Puma
2017-03-11T05:26:06.849544+00:00 app[web.1]: => Rails 5.0.0 application starting in production on http://0.0.0.0:56896
2017-03-11T05:26:06.849552+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-03-11T05:26:07.935302+00:00 app[web.1]: Puma starting in single mode...
2017-03-11T05:26:07.935323+00:00 app[web.1]: * Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl
2017-03-11T05:26:07.935324+00:00 app[web.1]: * Min threads: 5, max threads: 5
2017-03-11T05:26:07.935325+00:00 app[web.1]: * Environment: production
2017-03-11T05:26:07.935466+00:00 app[web.1]: * Listening on tcp://0.0.0.0:56896
2017-03-11T05:26:07.935709+00:00 app[web.1]: Use Ctrl-C to stop
2017-03-11T05:26:08.316445+00:00 heroku[web.1]: State changed from starting to up
2017-03-11T05:26:11.211047+00:00 app[web.1]: I, [2017-03-11T05:26:11.210942 #4]  INFO -- : [d795b023-4103-41a2-8825-ecb50be24fdd] Started HEAD "/" for 184.72.76.14 at 2017-03-11 05:26:11 +0000
2017-03-11T05:26:11.214433+00:00 app[web.1]: I, [2017-03-11T05:26:11.214374 #4]  INFO -- : [d795b023-4103-41a2-8825-ecb50be24fdd] Processing by PagesController#home as HTML
2017-03-11T05:26:11.243975+00:00 app[web.1]: D, [2017-03-11T05:26:11.243829 #4] DEBUG -- : [d795b023-4103-41a2-8825-ecb50be24fdd]   Plan Load (0.9ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
2017-03-11T05:26:11.257064+00:00 app[web.1]: D, [2017-03-11T05:26:11.256920 #4] DEBUG -- : [d795b023-4103-41a2-8825-ecb50be24fdd]   Plan Load (0.7ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 3], ["LIMIT", 1]]
2017-03-11T05:26:11.257752+00:00 app[web.1]: I, [2017-03-11T05:26:11.257692 #4]  INFO -- : [d795b023-4103-41a2-8825-ecb50be24fdd] Completed 404 Not Found in 43ms (ActiveRecord: 7.9ms)
2017-03-11T05:26:11.258611+00:00 app[web.1]: F, [2017-03-11T05:26:11.258542 #4] FATAL -- : [d795b023-4103-41a2-8825-ecb50be24fdd]   
2017-03-11T05:26:11.258689+00:00 app[web.1]: F, [2017-03-11T05:26:11.258627 #4] FATAL -- : [d795b023-4103-41a2-8825-ecb50be24fdd] ActiveRecord::RecordNotFound (Couldn't find Plan with 'id'=3):
2017-03-11T05:26:11.258744+00:00 app[web.1]: F, [2017-03-11T05:26:11.258692 #4] FATAL -- : [d795b023-4103-41a2-8825-ecb50be24fdd]   
2017-03-11T05:26:11.258855+00:00 app[web.1]: F, [2017-03-11T05:26:11.258746 #4] FATAL -- : [d795b023-4103-41a2-8825-ecb50be24fdd] app/controllers/pages_controller.rb:5:in `home'
2017-03-11T05:26:11.258728+00:00 heroku[router]: at=info method=HEAD path="/" host=limitless-fortress-32820.herokuapp.com request_id=d795b023-4103-41a2-8825-ecb50be24fdd fwd="184.72.76.14" dyno=web.1 connect=12ms service=118ms status=404 bytes=180 protocol=https
2017-03-11T05:58:12.552944+00:00 heroku[web.1]: Idling
2017-03-11T05:58:12.553609+00:00 heroku[web.1]: State changed from up to down
2017-03-11T05:58:13.333628+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-03-11T05:58:13.379474+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2017-03-11T05:58:13.379914+00:00 app[web.1]: === puma shutdown: 2017-03-11 05:58:13 +0000 ===
2017-03-11T05:58:13.379919+00:00 app[web.1]: - Goodbye!
2017-03-11T05:58:13.380079+00:00 app[web.1]: Exiting
2017-03-11T05:58:13.710764+00:00 heroku[web.1]: Process exited with status 0
2017-03-11T07:27:27.616986+00:00 heroku[web.1]: Unidling
2017-03-11T07:27:27.617784+00:00 heroku[web.1]: State changed from down to starting
2017-03-11T07:27:30.484604+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 53485 -e production`
2017-03-11T07:27:34.063443+00:00 app[web.1]: => Booting Puma
2017-03-11T07:27:34.063485+00:00 app[web.1]: => Rails 5.0.0 application starting in production on http://0.0.0.0:53485
2017-03-11T07:27:34.063487+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-03-11T07:27:34.745431+00:00 app[web.1]: Puma starting in single mode...
2017-03-11T07:27:34.745451+00:00 app[web.1]: * Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl
2017-03-11T07:27:34.745452+00:00 app[web.1]: * Min threads: 5, max threads: 5
2017-03-11T07:27:34.745453+00:00 app[web.1]: * Environment: production
2017-03-11T07:27:34.745551+00:00 app[web.1]: * Listening on tcp://0.0.0.0:53485
2017-03-11T07:27:34.745760+00:00 app[web.1]: Use Ctrl-C to stop
2017-03-11T07:27:35.323498+00:00 heroku[web.1]: State changed from starting to up
2017-03-11T07:27:36.716062+00:00 heroku[router]: at=info method=GET path="/" host=limitless-fortress-32820.herokuapp.com request_id=3034176c-dd58-4af0-8f70-745f440273db fwd="125.62.127.212" dyno=web.1 connect=0ms service=67ms status=404 bytes=1744 protocol=https
2017-03-11T07:27:36.683610+00:00 app[web.1]: I, [2017-03-11T07:27:36.683527 #4]  INFO -- : [3034176c-dd58-4af0-8f70-745f440273db] Started GET "/" for 125.62.127.212 at 2017-03-11 07:27:36 +0000
2017-03-11T07:27:36.686611+00:00 app[web.1]: I, [2017-03-11T07:27:36.686528 #4]  INFO -- : [3034176c-dd58-4af0-8f70-745f440273db] Processing by PagesController#home as HTML
2017-03-11T07:27:36.705959+00:00 app[web.1]: D, [2017-03-11T07:27:36.705867 #4] DEBUG -- : [3034176c-dd58-4af0-8f70-745f440273db]   Plan Load (0.6ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
2017-03-11T07:27:36.715238+00:00 app[web.1]: D, [2017-03-11T07:27:36.715149 #4] DEBUG -- : [3034176c-dd58-4af0-8f70-745f440273db]   Plan Load (2.1ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 3], ["LIMIT", 1]]
2017-03-11T07:27:36.715738+00:00 app[web.1]: I, [2017-03-11T07:27:36.715679 #4]  INFO -- : [3034176c-dd58-4af0-8f70-745f440273db] Completed 404 Not Found in 29ms (ActiveRecord: 8.8ms)
2017-03-11T07:27:36.716195+00:00 app[web.1]: F, [2017-03-11T07:27:36.716134 #4] FATAL -- : [3034176c-dd58-4af0-8f70-745f440273db]   
2017-03-11T07:27:36.716273+00:00 app[web.1]: F, [2017-03-11T07:27:36.716193 #4] FATAL -- : [3034176c-dd58-4af0-8f70-745f440273db] ActiveRecord::RecordNotFound (Couldn't find Plan with 'id'=3):
2017-03-11T07:27:36.716324+00:00 app[web.1]: F, [2017-03-11T07:27:36.716271 #4] FATAL -- : [3034176c-dd58-4af0-8f70-745f440273db]   
2017-03-11T07:27:36.716375+00:00 app[web.1]: F, [2017-03-11T07:27:36.716321 #4] FATAL -- : [3034176c-dd58-4af0-8f70-745f440273db] app/controllers/pages_controller.rb:5:in `home'
2017-03-11T07:27:37.337320+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=limitless-fortress-32820.herokuapp.com request_id=20bb1588-0933-4517-9605-0fdac9f274af fwd="125.62.127.212" dyno=web.1 connect=0ms service=1ms status=200 bytes=143 protocol=https
2017-03-11T08:01:45.234016+00:00 heroku[web.1]: Idling
2017-03-11T08:01:45.234777+00:00 heroku[web.1]: State changed from up to down
2017-03-11T08:01:46.059828+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-03-11T08:01:46.113060+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2017-03-11T08:01:46.113197+00:00 app[web.1]: === puma shutdown: 2017-03-11 08:01:46 +0000 ===
2017-03-11T08:01:46.113203+00:00 app[web.1]: - Goodbye!
2017-03-11T08:01:46.113318+00:00 app[web.1]: Exiting
2017-03-11T08:01:46.472377+00:00 heroku[web.1]: Process exited with status 0
2017-03-11T16:26:53.013220+00:00 heroku[web.1]: Unidling
2017-03-11T16:26:53.013532+00:00 heroku[web.1]: State changed from down to starting
2017-03-11T16:26:55.743205+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 42518 -e production`
2017-03-11T16:26:59.184085+00:00 app[web.1]: => Booting Puma
2017-03-11T16:26:59.184112+00:00 app[web.1]: => Rails 5.0.0 application starting in production on http://0.0.0.0:42518
2017-03-11T16:26:59.184113+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-03-11T16:26:59.813953+00:00 app[web.1]: Puma starting in single mode...
2017-03-11T16:26:59.813978+00:00 app[web.1]: * Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl
2017-03-11T16:26:59.814009+00:00 app[web.1]: * Min threads: 5, max threads: 5
2017-03-11T16:26:59.814025+00:00 app[web.1]: * Environment: production
2017-03-11T16:26:59.814139+00:00 app[web.1]: * Listening on tcp://0.0.0.0:42518
2017-03-11T16:26:59.814338+00:00 app[web.1]: Use Ctrl-C to stop
2017-03-11T16:27:00.213490+00:00 heroku[web.1]: State changed from starting to up
2017-03-11T16:27:01.161259+00:00 heroku[router]: at=info method=GET path="/" host=limitless-fortress-32820.herokuapp.com request_id=0394b2a7-1f84-42a8-9f38-5093385535b9 fwd="68.113.158.107,66.249.88.31" dyno=web.1 connect=1ms service=77ms status=404 bytes=1744 protocol=https
2017-03-11T16:27:01.104510+00:00 app[web.1]: I, [2017-03-11T16:27:01.104407 #4]  INFO -- : [0394b2a7-1f84-42a8-9f38-5093385535b9] Started GET "/" for 66.249.88.31 at 2017-03-11 16:27:01 +0000
2017-03-11T16:27:01.107677+00:00 app[web.1]: I, [2017-03-11T16:27:01.107612 #4]  INFO -- : [0394b2a7-1f84-42a8-9f38-5093385535b9] Processing by PagesController#home as HTML
2017-03-11T16:27:01.138947+00:00 app[web.1]: D, [2017-03-11T16:27:01.138843 #4] DEBUG -- : [0394b2a7-1f84-42a8-9f38-5093385535b9]   Plan Load (2.7ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
2017-03-11T16:27:01.144670+00:00 app[web.1]: D, [2017-03-11T16:27:01.144594 #4] DEBUG -- : [0394b2a7-1f84-42a8-9f38-5093385535b9]   Plan Load (1.0ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT $2  [["id", 3], ["LIMIT", 1]]
2017-03-11T16:27:01.145093+00:00 app[web.1]: I, [2017-03-11T16:27:01.145032 #4]  INFO -- : [0394b2a7-1f84-42a8-9f38-5093385535b9] Completed 404 Not Found in 37ms (ActiveRecord: 16.8ms)
2017-03-11T16:27:01.145493+00:00 app[web.1]: F, [2017-03-11T16:27:01.145437 #4] FATAL -- : [0394b2a7-1f84-42a8-9f38-5093385535b9]   
2017-03-11T16:27:01.145518+00:00 app[web.1]: F, [2017-03-11T16:27:01.145485 #4] FATAL -- : [0394b2a7-1f84-42a8-9f38-5093385535b9] ActiveRecord::RecordNotFound (Couldn't find Plan with 'id'=3):
2017-03-11T16:27:01.145558+00:00 app[web.1]: F, [2017-03-11T16:27:01.145518 #4] FATAL -- : [0394b2a7-1f84-42a8-9f38-5093385535b9]   
2017-03-11T16:27:01.145592+00:00 app[web.1]: F, [2017-03-11T16:27:01.145552 #4] FATAL -- : [0394b2a7-1f84-42a8-9f38-5093385535b9] app/controllers/pages_controller.rb:5:in `home'

我不熟悉破译这意味着什么。这是我的第一个申请。

3 个答案:

答案 0 :(得分:0)

您是否运行了所有迁移并设置了环境变量?在您的网站上启用Papertrail。然后,您可以查看应显示错误的日志。

答案 1 :(得分:0)

查看此处发生的最佳方法是阅读日志。您可以通过运行:

来完成此操作
heroku logs -a limitless-fortress-32820 (or whatever you named your app)

您可以在命令行中执行此操作,并假设您已安装heroku cli工具。 检查日志显示的错误并从那里开始。它可能是procfile,环境变量问题,迁移问题或任何数量的东西。

答案 2 :(得分:0)

实时查看heroku日志:

heroku logs -t -a limitless-fortress-32820

检查以下内容以解决问题:  你用过PG数据库吗?  2.是否所有迁移文件都已运行?