Home > Software engineering >  Heroku App Failing to Deploy on Rails Deployment, whats going wrong
Heroku App Failing to Deploy on Rails Deployment, whats going wrong

Time:06-21

Can anyone help me on this? My app keeps falling over when I deploy to Heroku. I'm not entirely sure what's going on.

I'm not that great at reading error message logs, and this is one of my first apps I've deployed. I'm happy to provide my gem file listing as well as maybe it's to do with these? Or some form of config in my routes? Or my DB?

Just let me know what's needed for debugging.

luke@luke-MS-7C91:~/newnewassignment/freelancer_assignment$ heroku logs
2022-06-19T11:36:41.179550 00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`
2022-06-19T11:36:43.883502 00:00 app[web.1]: => Booting Puma
2022-06-19T11:36:43.883516 00:00 app[web.1]: => Rails 7.0.3 application starting in production
2022-06-19T11:36:43.883516 00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2022-06-19T11:36:45.214698 00:00 app[web.1]: Puma starting in single mode...
2022-06-19T11:36:45.214735 00:00 app[web.1]: * Puma version: 5.6.4 (ruby 3.0.2-p107) ("Birdie's Version")
2022-06-19T11:36:45.214735 00:00 app[web.1]: *  Min threads: 5
2022-06-19T11:36:45.214735 00:00 app[web.1]: *  Max threads: 5
2022-06-19T11:36:45.214736 00:00 app[web.1]: *  Environment: production
2022-06-19T11:36:45.214736 00:00 app[web.1]: *          PID: 4
2022-06-19T11:36:45.214958 00:00 app[web.1]: * Listening on http://0.0.0.0:41431
2022-06-19T11:36:45.220478 00:00 app[web.1]: Use Ctrl-C to stop
2022-06-19T11:36:45.467856 00:00 heroku[web.1]: State changed from starting to up
2022-06-19T11:36:46.502654 00:00 app[web.1]: I, [2022-06-19T11:36:46.502567 #4]  INFO -- : [4b7d4b19-447d-4995-b2cd-465e8b2c3460] Started GET "/" for 86.6.238.212 at 2022-06-19 11:36:46  0000
2022-06-19T11:36:46.504201 00:00 app[web.1]: I, [2022-06-19T11:36:46.504148 #4]  INFO -- : [4b7d4b19-447d-4995-b2cd-465e8b2c3460] Processing by HomeController#index as HTML
2022-06-19T11:36:47.819972 00:00 app[web.1]: I, [2022-06-19T11:36:47.819885 #4]  INFO -- : [4b7d4b19-447d-4995-b2cd-465e8b2c3460] Completed 500 Internal Server Error in 1316ms (ActiveRecord: 1245.3ms | Allocations: 4713)
2022-06-19T11:36:47.820510 00:00 app[web.1]: F, [2022-06-19T11:36:47.820475 #4] FATAL -- : [4b7d4b19-447d-4995-b2cd-465e8b2c3460]
2022-06-19T11:36:47.820512 00:00 app[web.1]: [4b7d4b19-447d-4995-b2cd-465e8b2c3460] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "freelancers" does not exist
2022-06-19T11:36:47.820512 00:00 app[web.1]: LINE 9:  WHERE a.attrelid = '"freelancers"'::regclass
2022-06-19T11:36:47.820513 00:00 app[web.1]: ^
2022-06-19T11:36:47.820513 00:00 app[web.1]: ):
2022-06-19T11:36:47.820514 00:00 app[web.1]: [4b7d4b19-447d-4995-b2cd-465e8b2c3460]
2022-06-19T11:36:47.820514 00:00 app[web.1]: [4b7d4b19-447d-4995-b2cd-465e8b2c3460] app/controllers/home_controller.rb:7:in `index'
2022-06-19T11:36:47.821959 00:00 heroku[router]: at=info method=GET path="/" host=freelancers-applc.herokuapp.com request_id=4b7d4b19-447d-4995-b2cd-465e8b2c3460 fwd="86.6.238.212" dyno=web.1 connect=0ms service=1325ms status=500 bytes=1827 protocol=https
2022-06-19T11:36:48.010099 00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=freelancers-applc.herokuapp.com request_id=b1ceb926-a3b0-4b85-9fbf-62dbd0315434 fwd="86.6.238.212" dyno=web.1 connect=0ms service=1ms status=200 bytes=143 protocol=https
2022-06-19T11:37:19.971920 00:00 app[web.1]: I, [2022-06-19T11:37:19.971848 #4]  INFO -- : [f1b6578b-f5bf-4529-b396-b93eff1d46fa] Started GET "/" for 86.6.238.212 at 2022-06-19 11:37:19  0000
2022-06-19T11:37:19.972700 00:00 app[web.1]: I, [2022-06-19T11:37:19.972643 #4]  INFO -- : [f1b6578b-f5bf-4529-b396-b93eff1d46fa] Processing by HomeController#index as HTML
2022-06-19T11:37:19.979592 00:00 app[web.1]: I, [2022-06-19T11:37:19.979530 #4]  INFO -- : [f1b6578b-f5bf-4529-b396-b93eff1d46fa] Completed 500 Internal Server Error in 7ms (ActiveRecord: 4.2ms | Allocations: 257)
2022-06-19T11:37:19.980043 00:00 app[web.1]: F, [2022-06-19T11:37:19.980016 #4] FATAL -- : [f1b6578b-f5bf-4529-b396-b93eff1d46fa]
2022-06-19T11:37:19.980043 00:00 app[web.1]: [f1b6578b-f5bf-4529-b396-b93eff1d46fa] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "freelancers" does not exist
2022-06-19T11:37:19.980044 00:00 app[web.1]: LINE 9:  WHERE a.attrelid = '"freelancers"'::regclass
2022-06-19T11:37:19.980044 00:00 app[web.1]: ^
2022-06-19T11:37:19.980044 00:00 app[web.1]: ):
2022-06-19T11:37:19.980045 00:00 app[web.1]: [f1b6578b-f5bf-4529-b396-b93eff1d46fa]
2022-06-19T11:37:19.980045 00:00 app[web.1]: [f1b6578b-f5bf-4529-b396-b93eff1d46fa] app/controllers/home_controller.rb:7:in `index'
2022-06-19T11:37:19.980756 00:00 heroku[router]: at=info method=GET path="/" host=freelancers-applc.herokuapp.com request_id=f1b6578b-f5bf-4529-b396-b93eff1d46fa fwd="86.6.238.212" dyno=web.1 connect=0ms service=10ms status=500 bytes=1827 protocol=https
2022-06-19T11:38:03.688551 00:00 app[web.1]: I, [2022-06-19T11:38:03.688475 #4]  INFO -- : [1620c46f-edc7-4a32-b1b7-acf1e42734aa] Started GET "/" for 86.6.238.212 at 2022-06-19 11:38:03  0000
2022-06-19T11:38:03.689189 00:00 app[web.1]: I, [2022-06-19T11:38:03.689143 #4]  INFO -- : [1620c46f-edc7-4a32-b1b7-acf1e42734aa] Processing by HomeController#index as HTML
2022-06-19T11:38:03.694677 00:00 app[web.1]: I, [2022-06-19T11:38:03.694607 #4]  INFO -- : [1620c46f-edc7-4a32-b1b7-acf1e42734aa] Completed 500 Internal Server Error in 5ms (ActiveRecord: 2.4ms | Allocations: 230)
2022-06-19T11:38:03.695139 00:00 app[web.1]: F, [2022-06-19T11:38:03.695107 #4] FATAL -- : [1620c46f-edc7-4a32-b1b7-acf1e42734aa]
2022-06-19T11:38:03.695140 00:00 app[web.1]: [1620c46f-edc7-4a32-b1b7-acf1e42734aa] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "freelancers" does not exist
2022-06-19T11:38:03.695141 00:00 app[web.1]: LINE 9:  WHERE a.attrelid = '"freelancers"'::regclass
2022-06-19T11:38:03.695142 00:00 app[web.1]: ^
2022-06-19T11:38:03.695143 00:00 app[web.1]: ):
2022-06-19T11:38:03.695144 00:00 app[web.1]: [1620c46f-edc7-4a32-b1b7-acf1e42734aa]
2022-06-19T11:38:03.695144 00:00 app[web.1]: [1620c46f-edc7-4a32-b1b7-acf1e42734aa] app/controllers/home_controller.rb:7:in `index'
2022-06-19T11:38:03.695855 00:00 heroku[router]: at=info method=GET path="/" host=freelancers-applc.herokuapp.com request_id=1620c46f-edc7-4a32-b1b7-acf1e42734aa fwd="86.6.238.212" dyno=web.1 connect=0ms service=8ms status=500 bytes=1827 protocol=https
2022-06-19T11:38:04.597291 00:00 app[web.1]: I, [2022-06-19T11:38:04.597201 #4]  INFO -- : [dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa] Started GET "/" for 86.6.238.212 at 2022-06-19 11:38:04  0000
2022-06-19T11:38:04.598144 00:00 app[web.1]: I, [2022-06-19T11:38:04.598089 #4]  INFO -- : [dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa] Processing by HomeController#index as HTML
2022-06-19T11:38:04.602390 00:00 app[web.1]: I, [2022-06-19T11:38:04.602296 #4]  INFO -- : [dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa] Completed 500 Internal Server Error in 4ms (ActiveRecord: 2.2ms | Allocations: 240)
2022-06-19T11:38:04.602855 00:00 app[web.1]: F, [2022-06-19T11:38:04.602826 #4] FATAL -- : [dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa]
2022-06-19T11:38:04.602858 00:00 app[web.1]: [dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "freelancers" does not exist
2022-06-19T11:38:04.602859 00:00 app[web.1]: LINE 9:  WHERE a.attrelid = '"freelancers"'::regclass
2022-06-19T11:38:04.602859 00:00 app[web.1]: ^
2022-06-19T11:38:04.602860 00:00 app[web.1]: ):
2022-06-19T11:38:04.602861 00:00 app[web.1]: [dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa]
2022-06-19T11:38:04.602861 00:00 app[web.1]: [dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa] app/controllers/home_controller.rb:7:in `index'
2022-06-19T11:38:04.603558 00:00 heroku[router]: at=info method=GET path="/" host=freelancers-applc.herokuapp.com request_id=dc5a8846-8045-402a-a8d9-cdf7bcbbdcaa fwd="86.6.238.212" dyno=web.1 connect=0ms service=8ms status=500 bytes=1827 protocol=https
2022-06-19T11:39:09.889273 00:00 app[web.1]: I, [2022-06-19T11:39:09.889191 #4]  INFO -- : [56ddbc7b-7392-4755-9613-c4e2d53b61f3] Started GET "/" for 86.6.238.212 at 2022-06-19 11:39:09  0000
2022-06-19T11:39:09.890103 00:00 app[web.1]: I, [2022-06-19T11:39:09.890046 #4]  INFO -- : [56ddbc7b-7392-4755-9613-c4e2d53b61f3] Processing by HomeController#index as HTML
2022-06-19T11:39:09.894212 00:00 app[web.1]: I, [2022-06-19T11:39:09.894141 #4]  INFO -- : [56ddbc7b-7392-4755-9613-c4e2d53b61f3] Completed 500 Internal Server Error in 4ms (ActiveRecord: 2.1ms | Allocations: 240)
2022-06-19T11:39:09.895113 00:00 app[web.1]: F, [2022-06-19T11:39:09.895056 #4] FATAL -- : [56ddbc7b-7392-4755-9613-c4e2d53b61f3]
2022-06-19T11:39:09.895115 00:00 app[web.1]: [56ddbc7b-7392-4755-9613-c4e2d53b61f3] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "freelancers" does not exist
2022-06-19T11:39:09.895116 00:00 app[web.1]: LINE 9:  WHERE a.attrelid = '"freelancers"'::regclass
2022-06-19T11:39:09.895116 00:00 app[web.1]: ^
2022-06-19T11:39:09.895117 00:00 app[web.1]: ):
2022-06-19T11:39:09.895117 00:00 app[web.1]: [56ddbc7b-7392-4755-9613-c4e2d53b61f3]
2022-06-19T11:39:09.895118 00:00 app[web.1]: [56ddbc7b-7392-4755-9613-c4e2d53b61f3] app/controllers/home_controller.rb:7:in `index'
2022-06-19T11:39:09.895890 00:00 heroku[router]: at=info method=GET path="/" host=freelancers-applc.herokuapp.com request_id=56ddbc7b-7392-4755-9613-c4e2d53b61f3 fwd="86.6.238.212" dyno=web.1 connect=0ms service=8ms status=500 bytes=1827 protocol=https
2022-06-19T11:40:57.000000 00:00 app[api]: Build started by user [email protected]
2022-06-19T11:41:27.499422 00:00 heroku[web.1]: Restarting
2022-06-19T11:41:27.512420 00:00 heroku[web.1]: State changed from up to starting
2022-06-19T11:41:28.234391 00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-06-19T11:41:28.301459 00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2022-06-19T11:41:28.302141 00:00 app[web.1]: Exiting
2022-06-19T11:41:28.465197 00:00 heroku[web.1]: Process exited with status 143
2022-06-19T11:41:31.159791 00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`
2022-06-19T11:41:33.789631 00:00 app[web.1]: => Booting Puma
2022-06-19T11:41:33.789645 00:00 app[web.1]: => Rails 7.0.3 application starting in production
2022-06-19T11:41:33.789646 00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2022-06-19T11:41:35.043903 00:00 app[web.1]: Puma starting in single mode...
2022-06-19T11:41:35.043926 00:00 app[web.1]: * Puma version: 5.6.4 (ruby 3.0.2-p107) ("Birdie's Version")
2022-06-19T11:41:35.043927 00:00 app[web.1]: *  Min threads: 5
2022-06-19T11:41:35.043927 00:00 app[web.1]: *  Max threads: 5
2022-06-19T11:41:35.043927 00:00 app[web.1]: *  Environment: production
2022-06-19T11:41:35.043927 00:00 app[web.1]: *          PID: 4
2022-06-19T11:41:35.044142 00:00 app[web.1]: * Listening on http://0.0.0.0:40363
2022-06-19T11:41:35.049871 00:00 app[web.1]: Use Ctrl-C to stop
2022-06-19T11:41:35.558521 00:00 heroku[web.1]: State changed from starting to up
2022-06-19T11:41:36.896132 00:00 app[web.1]: [2d887a83-67fd-43af-a463-15307f715ab7] Started GET "/" for 86.6.238.212 at 2022-06-19 11:41:36  0000
2022-06-19T11:41:36.897465 00:00 app[web.1]: [2d887a83-67fd-43af-a463-15307f715ab7] Processing by HomeController#index as HTML
2022-06-19T11:41:36.961014 00:00 app[web.1]: [2d887a83-67fd-43af-a463-15307f715ab7] Completed 500 Internal Server Error in 63ms (ActiveRecord: 29.9ms | Allocations: 4701)
2022-06-19T11:41:36.963144 00:00 app[web.1]: [2d887a83-67fd-43af-a463-15307f715ab7]
2022-06-19T11:41:36.963146 00:00 app[web.1]: [2d887a83-67fd-43af-a463-15307f715ab7] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "freelancers" does not exist
2022-06-19T11:41:36.963148 00:00 app[web.1]: LINE 9:  WHERE a.attrelid = '"freelancers"'::regclass
2022-06-19T11:41:36.963150 00:00 app[web.1]: ^
2022-06-19T11:41:36.963151 00:00 app[web.1]: ):
2022-06-19T11:41:36.963151 00:00 app[web.1]: [2d887a83-67fd-43af-a463-15307f715ab7]
2022-06-19T11:41:36.963151 00:00 app[web.1]: [2d887a83-67fd-43af-a463-15307f715ab7] app/controllers/home_controller.rb:7:in `index'
2022-06-19T11:41:36.964304 00:00 heroku[router]: at=info method=GET path="/" host=freelancers-applc.herokuapp.com request_id=2d887a83-67fd-43af-a463-15307f715ab7 fwd="86.6.238.212" dyno=web.1 connect=0ms service=74ms status=500 bytes=1827 protocol=https```

CodePudding user response:

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "freelancers" does not exist 2022-06-19T11:36:47.820512 00:00 app[web.1]: LINE 9: WHERE a.attrelid = '"freelancers"'::regclass

As you can see in the log table freelancers doesn't exist. You need to run the migration to make it work.

Run the migration through Heroku CLI heroku run rails db:migrate -a app-name

Use Heroku Dashboard to run the migration

  • I. Login to Heroku
  • II. Select the app > Click on More options
  • III. Click on Run Console
  • IV. Enter rake db:migrate and Click Run
  • Related