subaru-hello / Zeroken

一軒目に飲むお酒と飲む順番を提供するアプリ
5 stars 0 forks source link

フロントとバックのホスト番号の違いを改善したい。 #121

Closed subaru-hello closed 2 years ago

subaru-hello commented 2 years ago
| 08:32:24 web.1     | => Booting Puma
web_1  | 08:32:24 web.1     | => Rails 6.1.4.1 application starting in development 
web_1  | 08:32:24 web.1     | => Run `bin/rails server --help` for more startup options
web_1  | 08:33:02 web.1     | Puma starting in single mode...
web_1  | 08:33:02 web.1     | * Puma version: 5.5.2 (ruby 2.6.6-p146) ("Zawgyi")
web_1  | 08:33:03 web.1     | *  Min threads: 5
web_1  | 08:33:03 web.1     | *  Max threads: 5
web_1  | 08:33:03 web.1     | *  Environment: development
web_1  | 08:33:03 web.1     | *          PID: 8
web_1  | 08:33:03 web.1     | * Listening on http://127.0.0.1:3000
web_1  | 08:33:05 web.1     | Use Ctrl-C to stop
web_1  | 08:33:18 webpack.1 | ℹ 「wdm」: Hash: 54d221d851e27ffb17db
web_1  | 08:33:18 webpack.1 | Version: webpack 4.46.0
web_1  | 08:33:18 webpack.1 | Time: 357566ms
web_1  | 08:33:18 webpack.1 | Built at: 01/18/2022 8:33:04 AM

127.0.0.1:3000にアクセスした際の画面 Image from Gyazo

仮説

クロスリソース通信エラーなのではないかと考えている。 https://github.com/webpack/webpack-dev-server/issues/416

このissueが参考になりそう これも

subaru-hello commented 2 years ago

rails s をコンソールで打ったときに走る箇所。 https://github.com/rails/rails/blob/4-2-stable/railties/lib/rails/commands/server.rb

subaru-hello commented 2 years ago

現在の挙動

POSTする値は取得することができている。analyzeに問題があると考えた。

2022-01-19T05:44:53.781510+00:00 heroku[router]: at=info method=GET path="/packs/media/src/img/beer-147613885aaf2ff2fe437458184173db.jpeg" host=zeroken.herokuapp.com request_id=13211ff8-c97d-4714-b864-835770fe4ec9 fwd="126.140.202.6" dyno=web.1 connect=0ms service=1ms status=304 bytes=62 protocol=https
2022-01-19T05:45:16.306380+00:00 heroku[router]: at=info method=POST path="/api/v1/analyzes" host=zeroken.herokuapp.com request_id=1e830b4e-7e7c-431d-8b59-42b1b5e4b09c fwd="126.140.202.6" dyno=web.1 connect=0ms service=5ms status=500 bytes=1149 protocol=https
2022-01-19T05:45:16.302560+00:00 app[web.1]: I, [2022-01-19T05:45:16.302490 #4]  INFO -- : [1e830b4e-7e7c-431d-8b59-42b1b5e4b09c] Started POST "/api/v1/analyzes" for 126.140.202.6 at 2022-01-19 05:45:16 +0000
2022-01-19T05:45:16.305099+00:00 app[web.1]: I, [2022-01-19T05:45:16.305050 #4]  INFO -- : [1e830b4e-7e7c-431d-8b59-42b1b5e4b09c] Processing by Api::V1::AnalyzesController#create as JSON
2022-01-19T05:45:16.305146+00:00 app[web.1]: I, [2022-01-19T05:45:16.305118 #4]  INFO -- : [1e830b4e-7e7c-431d-8b59-42b1b5e4b09c]   Parameters: {"analyze"=>{"total_points"=>4.359999999999998, "alcohol_strongness"=>4, "next_motivation"=>2, "shuchedule"=>14, "description"=>"気持ち悪くなるまで呑み続けてしまう愉快なタイプの酒豪"}}
2022-01-19T05:45:16.306077+00:00 app[web.1]: I, [2022-01-19T05:45:16.306027 #4]  INFO -- : [1e830b4e-7e7c-431d-8b59-42b1b5e4b09c] Completed 500 Internal Server Error in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 417)
subaru-hello commented 2 years ago

本番環境での挙動。

 Starting process with command `bundle exec rails s -b 0.0.0.0`
2022-01-19T13:32:32.132438+00:00 app[web.1]: => Booting Puma
2022-01-19T13:32:32.132450+00:00 app[web.1]: => Rails 6.1.4.1 application starting in production
2022-01-19T13:32:32.132450+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2022-01-19T13:32:33.667608+00:00 app[web.1]: Puma starting in single mode...
2022-01-19T13:32:33.667637+00:00 app[web.1]: * Puma version: 5.5.2 (ruby 2.6.6-p146) ("Zawgyi")
2022-01-19T13:32:33.667638+00:00 app[web.1]: *  Min threads: 5
2022-01-19T13:32:33.667638+00:00 app[web.1]: *  Max threads: 5
2022-01-19T13:32:33.667638+00:00 app[web.1]: *  Environment: production
2022-01-19T13:32:33.667638+00:00 app[web.1]: *          PID: 4
2022-01-19T13:32:33.667793+00:00 app[web.1]: * Listening on http://0.0.0.0:10625

   |   ApiKey Load (2.5ms)  SELECT `api_keys`.* FROM `api_keys` WHERE `api_keys`.`user_id` = 1 AND (expires_at >= '2022-01-19 13:48:19.129737') ORDER BY `api_keys`.`id` ASC LIMIT 1
web_1  | 13:48:19 web.1     |   ↳ app/models/user.rb:42:in `activate_api_key!'
web_1  | 13:48:19 web.1     |    (2.7ms)  SELECT `analyzes`.`id` FROM `analyzes` WHERE `analyzes`.`user_id` = 1
web_1  | 13:48:19 web.1     |   ↳ app/controllers/api/v1/guest_login_controller.rb:9:in `create'
web_1  | 13:48:19 web.1     | Completed 200 OK in 73ms (Views: 0.4ms | ActiveRecord: 11.5ms | Allocations: 3716)
web_1  | 13:48:19 web.1     | 
web_1  | 13:48:19 web.1     | 
web_1  | 13:48:31 web.1     | Started POST "/api/v1/analyzes" for 192.168.32.1 at 2022-01-19 13:48:31 +0000
web_1  | 13:48:31 web.1     | Processing by Api::V1::AnalyzesController#create as JSON
web_1  | 13:48:31 web.1     |   Parameters: {"analyze"=>{"total_points"=>-12.080000000000002, "alcohol_strongness"=>0, "next_motivation"=>2, "shuchedule"=>17, "description"=>"家でしっぽりと飲む方が好きなタイプの下戸"}}
web_1  | 13:48:31 web.1     | Completed 500 Internal Server Error in 5ms (Views: 0.3ms | ActiveRecord: 0.0ms | Allocations: 1534)
subaru-hello commented 2 years ago

4550d29 で解決