Application error when deploying my Rails app to heroku - ruby-on-rails

I cannot seem to find the error in my rails app. The app was working fine but after a simple deploy (changing one controller file for an api), not a single page will load. The logs are of no help either:
2018-01-04T18:23:04.899516+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:31202
2018-01-04T18:23:04.899701+00:00 app[web.1]: [4] Use Ctrl-C to stop
2018-01-04T18:23:05.040894+00:00 app[web.1]: [4] - Worker 0 (pid: 12) booted, phase: 0
2018-01-04T18:23:05.043093+00:00 app[web.1]: [4] - Worker 1 (pid: 15) booted, phase: 0
2018-01-04T18:23:05.394579+00:00 heroku[web.1]: State changed from starting to up
2018-01-04T18:23:11+00:00 app[heroku-redis]: source=REDIS sample#active-connections=2 sample#load-avg-1m=0.075 sample#load-avg-5m=0.08 sample#load-avg-15m=0.055 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15664468kB sample#memory-free=12572192kB sample#memory-cached=1275064kB sample#memory-redis=300080bytes sample#hit-rate=0.99862 sample#evicted-keys=0
2018-01-04T18:23:45.338930+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www..com request_id=d5b547d3-a969-4649-a729-66f9db19eb95 fwd="66.87.124.194" dyno= connect= service= status=503 bytes= protocol=https
2018-01-04T18:23:50.649738+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www..com request_id=25924358-2142-46d0-8186-c516a6bafcb7 fwd="66.87.124.194" dyno= connect= service= status=503 bytes= protocol=https
2018-01-04T18:23:55.958718+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www..com request_id=0eeb82f8-5bd8-4a95-bd07-8a9e023ae893 fwd="66.87.124.194" dyno= connect= service= status=503 bytes= protocol=https
any ideas? I've tried rolling back and that doesn't seem to fix anything?
Update:
Without doing anything it randomly started up again? Why would this happen?
2018-01-04T18:27:10.443578+00:00 app[web.1]: Started GET "/" for 24.60.204.37 at 2018-01-04 18:27:10 +0000
2018-01-04T18:27:10.572471+00:00 app[web.1]: Processing by StaticPagesController#home_v3 as HTML
2018-01-04T18:27:10.572498+00:00 app[web.1]: Parameters: {"secure"=>true}
Update 2:
It's back down again but the console works (heroku run rails c)?

This is a problem with Heroku at this time. Here is a link to their incident report: https://status.heroku.com/incidents/1367
Since approximately 18:10 UTC (1:10 PM Eastern), application Dynos are failing to start up after releases take place. Our engineers are investigating the cause of this issue.
Edit Could be coincidence, but I was restarting our app periodically, and now it is back up again. One person worked around this by beefing up a non-production instance and routing traffic to it.

Related

docker app on heroku down, but won't start after sending request

I have a spring boot rest api backend packed in a docker container and deployed to heroku under the free plan. It works and after a half hour it goes sleeping. But later, when I open the app and want to send some request, it doesn't start. I see from the logs, that the app was crashed.
Why is that? Why won't the app start? Why even was the app crashed, if it was shutting down gracefully?
Here is the log:
2022-02-27T19:58:05.770090+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2022-02-27T19:58:22.938286+00:00 heroku[web.1]: Idling
2022-02-27T19:58:23.030649+00:00 heroku[web.1]: State changed from up to down
2022-02-27T19:58:23.707002+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-02-27T19:58:24.136754+00:00 app[web.1]: 2022-02-27 19:58:24.136 INFO 3 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-02-27T19:58:24.158799+00:00 app[web.1]: 2022-02-27 19:58:24.154 INFO 3 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-02-27T19:58:24.192171+00:00 app[web.1]: 2022-02-27 19:58:24.191 INFO 3 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2022-02-27T19:58:24.493677+00:00 heroku[web.1]: Process exited with status 143
2022-02-28T10:01:59.256200+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=**** request_id=3e55141d-753c-4f91-b60b-2c78342f913a fwd="****" dyno= connect= service= status=503 bytes= protocol=https
2022-02-28T10:01:59.869943+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=**** request_id=c64f6bb8-d9af-41ca-ac11-47cdc542eb32 fwd="****" dyno= connect= service= status=503 bytes= protocol=https
2022-02-28T10:02:29.304593+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=**** request_id=9455eceb-fe52-41c4-9016-12496f2dce93 fwd="****" dyno= connect= service= status=503 bytes= protocol=https

Error when opening heroku app

I have deployed my rails app to heroku, and am now trying to open it with "heroku open", however i get the error that "An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.". These are the logs:
2017-12-26T18:40:16.269452+00:00 app[web.1]: => Booting Puma
2017-12-26T18:40:16.261939+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
2017-12-26T18:40:16.261951+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
2017-12-26T18:40:16.269455+00:00 app[web.1]: => Rails 5.1.4 application starting in production
2017-12-26T18:40:16.261978+00:00 app[web.1]: from bin/rails:9:in `require'
2017-12-26T18:40:16.269456+00:00 app[web.1]: Exiting
2017-12-26T18:40:16.269455+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-12-26T18:40:16.372189+00:00 heroku[web.1]: State changed from starting to crashed
2017-12-26T18:40:16.359435+00:00 heroku[web.1]: Process exited with status 1
2017-12-26T18:40:16.911232+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pacific-stream-77985.herokuapp.com request_id=60caaad5-f16e-4443-8b8f-e278d41d966d fwd="2.104.49.204" dyno= connect= service= status=503 bytes= protocol=https
2017-12-26T18:40:57.610077+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pacific-stream-77985.herokuapp.com request_id=9b3b9601-d003-49fd-8661-fd4494f84632 fwd="2.104.49.204" dyno= connect= service= status=503 bytes= protocol=https
2017-12-26T18:45:46.508705+00:00 heroku[run.1739]: Awaiting client
2017-12-26T18:45:46.560426+00:00 heroku[run.1739]: Starting process with command `rails db:migrate`
2017-12-26T18:45:46.570612+00:00 heroku[run.1739]: State changed from starting to up
2017-12-26T18:45:42.507797+00:00 app[api]: Starting process with command `rails db:migrate` by user <mymail>#gmail.com
2017-12-26T18:45:53.393255+00:00 heroku[run.1739]: Process exited with status 0
2017-12-26T18:45:53.406858+00:00 heroku[run.1739]: State changed from up to complete
2017-12-26T18:46:09.405442+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pacific-stream-77985.herokuapp.com request_id=e38838f5-294c-45eb-a936-81f89e8fed2d fwd="2.104.49.204" dyno= connect= service= status=503 bytes= protocol=https

Rails app - working fine locally but not on heroku

I am building a simple app in Rails, everything has been working fine so far but now, after not working on it for a while, I cannot run the app in Heroku. Here are the errors I have on my logs. I would appreciate if someone could help me with these problem.
> 2016-01-07T10:25:13.640157+00:00 heroku[api]: Starting process with command `rails console` by chmorasan#gmail.com
> heroku[run.9775]: Awaiting client heroku[run.9775]: State changed from
> starting to up heroku[run.9775]: Error R13 (Attach error) -> Failed to
> a heroku[run.9775]: Process exited with status 128 heroku[run.9775]:
> State changed from up to complete heroku[run.1708]: State changed from
> starting to up
2016-01-07T09:08:52.323403+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=thecornershop.herokuapp.com request_id=469ee49d-d3a5-40bb-a6a7-f50efbfb89ef fwd="194.224.214.178" dyno= connect= service= status=503 bytes=
2016-01-07T09:08:52.788969+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=thecornershop.herokuapp.com request_id=cf2a50ed-2ef8-440a-8bc4-15be5f1f2244 fwd="194.224.214.178" dyno= connect= service= status=503 bytes=
2016-01-07T09:22:41.171885+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=thecornershop.herokuapp.com request_id=ba18bf52-9740-4e4e-b5bb-1f54dd40acb1 fwd="194.224.214.178" dyno= connect= service= status=503 bytes=
2016-01-07T09:22:41.699518+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=thecornershop.herokuapp.com request_id=babe9b0d-e6f5-4e0f-8d76-35a7217165eb fwd="194.224.214.178" dyno= connect= service= status=503 bytes=
I finally found the problem, it was somethings that I forgot to erase in a earlier mistake I did migrating, I just forgot to look in the actual db migrate. Thanks for the help.
I am not sure that which command you are trying to run on heroku, however, your log says:
heroku[run.9775]: Awaiting client heroku[run.9775]: State changed from starting to up heroku[run.9775]: Error R13 (Attach error)
Try to detach your command from terminal. Run it in the "background"
heroku run:detached <YOUR_COMMAND>
EDIT:
As you are trying to migrate your migration files:
heroku run:detached rake db:migrate

H10 error, desc="App crashed" showing "Application Error" on the heroku page

I am trying to deploy my application from my desktop to heroku. But shoiwng application error on the page. Here is the display of heroku logs :
2015-05-17T14:23:16.824327+00:00 app[web.1]: Exiting
2015-05-17T14:23:16.796436+00:00 app[web.1]: from bin/rails:8:in `<main>'
2015-05-17T14:23:16.796435+00:00 app[web.1]: from bin/rails:8:in `require'
2015-05-17T14:23:17.773437+00:00 heroku[web.1]: State changed from starting to crashed
2015-05-17T14:23:17.760552+00:00 heroku[web.1]: Process exited with status 1
2015-05-17T14:23:57.689913+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pacific-beach-3105.herokuapp.com request_id=85de2fe6-d894-4f53-a995-1285be93c58d fwd="203.110.246.22" dyno= connect= service= status=503 bytes=
2015-05-17T14:23:59.999420+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pacific-beach-3105.herokuapp.com request_id=7384ee1f-1efc-4801-9a4a-a34a0d17f8fb fwd="203.110.246.22" dyno= connect= service= status=503 bytes=
2015-05-17T14:24:01.833524+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pacific-beach-3105.herokuapp.com request_id=934a68f4-84e5-4259-9455-52d8f8602c06 fwd="203.110.246.22" dyno= connect= service= status=503 bytes=
2015-05-17T14:24:31.083965+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by sameerrrana#gmail.com
2015-05-17T14:24:34.043331+00:00 heroku[run.6109]: Starting process with command `bundle exec rake db:migrate`
2015-05-17T14:24:34.759590+00:00 heroku[run.6109]: State changed from starting to up
2015-05-17T14:24:38.220213+00:00 app[run.6109]: ActiveRecord::SchemaMigration Load (1.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2015-05-17T14:24:38.954062+00:00 heroku[run.6109]: State changed from up to complete
2015-05-17T14:24:38.944714+00:00 heroku[run.6109]: Process exited with status 0
2015-05-17T14:25:11.918187+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pacific-beach-3105.herokuapp.com request_id=d5969403-490c-4da1-aa01-905bfd39b9a1 fwd="203.110.246.22" dyno= connect= service= status=503 bytes=
2015-05-17T14:34:31.213525+00:00 heroku[api]: Starting process with command `rails console` by sameerrrana#gmail.com
2015-05-17T14:34:35.566430+00:00 heroku[run.6202]: Awaiting client
2015-05-17T14:34:35.900197+00:00 heroku[run.6202]: State changed from starting to up
2015-05-17T14:35:05.572297+00:00 heroku[run.6202]: Error R13 (Attach error) -> Failed to attach to process
2015-05-17T14:35:07.029088+00:00 heroku[run.6202]: Process exited with status 128
2015-05-17T14:35:07.045904+00:00 heroku[run.6202]: State changed from up to complete
2015-05-17T14:40:45.980758+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by sameerrrana#gmail.com
2015-05-17T14:40:50.488405+00:00 heroku[run.7608]: Starting process with command `bundle exec rake db:migrate`
2015-05-17T14:40:51.155554+00:00 heroku[run.7608]: State changed from starting to up
2015-05-17T14:40:56.358175+00:00 app[run.7608]: ActiveRecord::SchemaMigration Load (2.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
2015-05-17T14:40:57.410610+00:00 heroku[run.7608]: State changed from up to complete
2015-05-17T14:40:57.396701+00:00 heroku[run.7608]: Process exited with status 0
2015-05-17T14:41:11.499509+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pacific-beach-3105.herokuapp.com request_id=ddc2f1be-2fb0-43d6-a24d-00e9a6631be0 fwd="203.110.246.22" dyno= connect= service= status=503 bytes=
I have been to every question regarding Application error and Error H10 but can't solve it . Please help
Add this line in the Gemfile.
gem 'pg', group: :production
then
bundle install
and commit the changes to the github. And then run the command
git push heroku master

Nginx and Heroku. Serving Static Files

Goal:
Going to https://secret-sands-1568.herokuapp.com/myFile.html will display the content of client/myFile.html sent by Nginx.
From what I understand, Heroku dynos are normally used for Nodejs/Ruby/other apps but they can be converted to anything by modifying the buildrack.
I copied the content of https://github.com/theoephraim/nginx-buildpack.
I added a folder named tmp with a file app-initialized.
I added a folder named client with a file myFile.html.
In config/nginx.conf.erb, I changed location / by
location / {
root client;
index index.html index.htm;
}
I created a file Procfile with content: web: bin/start-nginx.
I entered heroku config:set BUILDPACK_URL=https://github.com/ryandotsmith/nginx-buildpack.git.
I entered git init heroku create git push heroku master heroku ps:scale web=1.
Yet, when I go https://secret-sands-1568.herokuapp.com/myFile.html, there's nothing. Heroku logs says:
2015-05-19T07:13:32.990254+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:33.995458+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:34.998228+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:36.000823+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:37.005955+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:38.008548+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:39.011184+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:40.013788+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:41.016516+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:42.019372+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:43.023551+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:44.029985+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:45.035183+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:45.910618+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-05-19T07:13:45.910618+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-05-19T07:13:46.732519+00:00 heroku[web.1]: State changed from starting to crashed
2015-05-19T07:13:46.718745+00:00 heroku[web.1]: Process exited with status 137
2015-05-19T07:17:12.890713+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=obscure-caverns-1927.herokuapp.com request_id=6d15e849-ce45-41bc-9bad-60d9eb0454ef fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:13.039723+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-caverns-1927.herokuapp.com request_id=7aeecc36-05b5-4799-bf0a-6ba97b2a6190 fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:18.350029+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/myFile" host=obscure-caverns-1927.herokuapp.com request_id=cb77356f-ddf3-4795-b56d-fa9cde5d134a fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:18.471762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-caverns-1927.herokuapp.com request_id=64a89596-b287-4b89-a3ce-ed750e4fb1c1 fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:22.250495+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-caverns-1927.herokuapp.com request_id=4ccda4e8-1532-49dc-8658-e67312ef333d fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:22.125124+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/myFile.html" host=obscure-caverns-1927.herokuapp.com request_id=33cdee81-2dda-44cb-acf7-2dc5b4156ef2 fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
What am I doing wrong? My goal is to have a stand-alone Nginx server that deserve static file.
Edit: For serving static files specifically, you don't need to go through all the effort of this. There's a buildpack heroku-community/static which is hugely more simple than the nginx ones, and the instructions cater to static sites. And I just got my Angular site working using it.
I know this probably won't help the original asker, but it will probably help others who find this.
Note: This is only a partial answer. I'm still looking for more debugs. But I managed to get mine to go from a Timeout to serving all 404 pages by doing the following.
Also note, I'm not using one from github. I'm using https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-nginx, added via heroku buildpacks:add heroku-community/nginx
Procfile:
web: bin/start-nginx-solo
This should serve static files instead of trying to route to another listener.
So far, I keep getting nginx errors as follows: open() "/dist/index.html" failed (2: No such file or directory) (These are from app[web.1]). The build was successful, but it just can't locate any of the files. Still working on that, but at least it doesn't crash due to boot timeouts anymore.

Resources