Debugging Heroku using logs - ruby-on-rails

React frontend with rails backend. Deploying with NPM. Deployed successfully but failing to fetch with this error--
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/users"
There's no information in the logs about what crashed it ends with:
2020-06-19T01:21:42.298326+00:00 heroku[web.1]: Process exited with status 1
2020-06-19T01:21:42.342497+00:00 heroku[web.1]: State changed from starting to crashed
I get this warning when pushing to heroku
remote: Detecting rails configuration failed
remote: set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
I've been googling this all day and can not find a solution. What I can gather is that it just isn't connecting to the postgres db. How do I debug this?

You can actually ssh into the heroku using the heroku-cli instance to try to start rails server on your own.
or look into the log folder.
heroku ps:exec -a your-app-name

Related

Rails app Heroku failure

I have an app that works locally but does does not work right on heroku. The root page loads, but when I try the submit link, Heroku gives me "We're sorry, but something went wrong.
If you are the application owner check the logs for more information."
Looking at the logs, its seems like an asset issue and ive run "RAILS_ENV=production bundle exec rake assets:precompile" but I still get these log errors.
2014-09-22T01:09:39.694028+00:00 app[web.1]: [2014-09-22 01:09:39] INFO WEBrick 1.3.1
2014-09-22T01:09:39.694047+00:00 app[web.1]: [2014-09-22 01:09:39] INFO ruby 2.0.0 (2014- 09-19) [x86_64-linux]
2014-09-22T01:09:39.694487+00:00 app[web.1]: [2014-09-22 01:09:39] INFO WEBrick::HTTPServer#start: pid=2 port=24344
2014-09-22T01:09:39.797519+00:00 heroku[web.1]: State changed from starting to up
2014-09-22T01:09:40.724903+00:00 heroku[router]: at=info method=GET path="/" host=findmegnar.herokuapp.com request_id=502f7e98-22da-4825-ad85-77606ab64cca fwd="54.162.73.140" dyno=web.1 connect=2ms service=130ms status=200 bytes=1907
2014-09-22T01:09:44.875965+00:00 heroku[router]: at=info method=GET path="/" host=findmegnar.herokuapp.com request_id=900ca4d9-db6c-4c53-aeb4-f6e50c0a7e4f fwd="74.95.112.118" dyno=web.1 connect=0ms service=16ms status=304 bytes=733
2014-09-22T01:09:44.978618+00:00 heroku[router]: at=info method=GET path="/assets/application-cb25950d0e442f07f1fa7be553c321c3.css" host=findmegnar.herokuapp.com request_id=13b510e0-f3c8-4f1a-8a29-9d99a30fb794 fwd="74.95.112.118" dyno=web.1 connect=1ms service=9ms status=404 bytes=1829
2014-09-22T01:09:44.987883+00:00 heroku[router]: at=info method=GET path="/assets/application-433aac58cfba85b04e81533418015cc6.js" host=findmegnar.herokuapp.com request_id=2cbaa67e-646e-4faf-adee-c9c4606fe662 fwd="74.95.112.118" dyno=web.1 connect=0ms service=6ms status=404 bytes=1829
2014-09-22T01:09:47.967521+00:00 heroku[router]: at=info method=POST path="/searches" host=findmegnar.herokuapp.com request_id=2948d744-102f-420b-a856-63a55ab3e0c5 fwd="74.95.112.118" dyno=web.1 connect=1ms service=16ms status=500 bytes=1754
Edit: Further work found that this error was caused by lack of database. Running
heroku run rake db:reset
Fixed that issue. However, running
heroku run rake import:resorts
Did a rake import of the data I wanted to add to the data but did not actually add the data to the db.
Does anyone know if there is a special way to do rake tasks in heroku?
Heroku
If you're loading your database on Heroku again, you'll probably be best using the rake db:schema:load task - this builds the database from your schema, instead of your migrations.
#db/schema.rb
# If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch
To access Heroku functionality from your development command-line, you'll be best making use of the Heroku Toolbelt -
$ heroku run rake db:schema:load
$ heroku run ...
This enables you to perform Heroku actions from your development (local) machine. It routes your request through the Heroku API, allowing you to perform requests on the Heroku command-line as required
Errors
If you're experiencing errors on Heroku, just as some information, you'll be best looking at how they work, and appreciating how to resolve them.
There are two types of error with Heroku:
Heroku
These are caused by your application not opening on Heroku itself
The problem here is that Heroku will have a certain set of "dependencies" which are required to run your application. These dependencies are in the form of the likes of your database, files, add-ons, ENV variables, etc.
If you don't have any of these available to your app, for whatever reason, you'll end up receiving the "platform" error as mentioned above. The fix for this is purely with Heroku - you need to ensure you have the files, settings & add-ons required to get your app working correctly
-
Rails
Rails errors are specific to your application, and are likely a result of bad syntax inside your application. The distinction here is that the platform error is going to be caused by Heroku, whilst the Rails error is going to be caused by your app.
If you're seeing the above error, the simplest way to resolve it is to locate the following file & change it temporarily:
#config/environments/production.rb
config.consider_all_requests_local = true # false
By pushing this to Heroku again, you'll be able to see the errors you had on your application through the standard Rails error-handling interface

rails heroku - error code H10 bash: bin/rails: No such file or directory

I am trying to follow Michael Hartl's rails tutorial adding authentication step 7.29 (http://ruby.railstutorial.org/chapters/sign-up#top). My project works locally but I get "an error occurred in the application and your page could not be served" when I try deploying to heroku. These are my log errors:
heroku[api]: Starting process with command `bundle exec rake db:migrate` by connorleech#gmail.com
heroku[run.1285]: Awaiting client
heroku[run.1285]: Starting process with command `bundle exec rake db:migrate`
heroku[run.1285]: State changed from starting to up
heroku[run.1285]: Process exited with status 0
heroku[run.1285]: State changed from up to complete
heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=jason-shark-rails-project.herokuapp.com fwd="41.74.174.50" dyno= connect= service= status=503 bytes=
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `bin/rails server -p 10431 -e $RAILS_ENV`
app[web.1]: bash: bin/rails: No such file or directory
heroku[web.1]: Process exited with status 127
heroku[web.1]: State changed from starting to crashed
heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
heroku[web.1]: Stopping process with SIGKILL
It seems I may be missing something in my project in order to deploy it.. bash: bin/rails: No such file or directory
Why does my app work locally but not deploy to heroku?
Rails 4 project had a /bin directory, unlike some older Rails 3 projects I had cloned. /bin contains 3 files, bundle, rails, and rake, but these weren't making it to Heroku because I had bin in my global .gitignore file.
This is a pretty common ignore rule if you work with Git and other languages (Java, etc.), so to fix this:
Remove bin from ~/.gitignore
Run bundle install
Commit your
changes with git add . and git commit -m "Add bin back"
Push your changes to Heroku with git push heroku master
I had a similar problem, for some reason the /bin folder was not copying to my GitHub repo (check yours?). After trying many other solutions unsuccessfully, I ran git add bin and that let me push the bin folder to GitHub. I'm still unsure why I had to make this exception for the bin folder specifically. Running Ruby v2, Rails v4, on Linux.

Heroku App Crash H10 - bash: bin/rails: No such file or directory [duplicate]

This question already has answers here:
"bin/rails: No such file or directory" w/ Ruby 2 & Rails 4 on Heroku
(8 answers)
Closed 9 years ago.
I am having an issue with my deployment. My test env locally works great with no errors. When I push to Heroku I get this:
2013-07-17T15:54:04.619297+00:00 app[web.1]: bash: bin/rails: No such file or directory
2013-07-17T15:54:07.240398+00:00 heroku[web.1]: Process exited with status 127
2013-07-17T15:54:07.255379+00:00 heroku[web.1]: State changed from starting to crashed
2013-07-17T15:54:13.467325+00:00 heroku[web.1]: Error R99 (Platform error) -> Failed to launch the dyno within 10 seconds
2013-07-17T15:54:13.467325+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-07-17T15:54:58.714647+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=radiant-thicket-1062.herokuapp.com fwd="174.4.33.188" dyno= connect= service= status=503 bytes=
I am unsure where anything is calling bin/rails or how to solve this. I can't find any information on this anywhere else with the H10. It's like I'm the only person to ever experience this (unlikely..)!
I'd appreciate any insight or help. Thank you!
You're missing the bin folder that was added in Rails 4. Run rake rails:update:bin to create it, then make a commit and push to Heroku.
I found a solution to the problem - it's quite simple:
heroku config:set PATH=bin:vendor/bundle/ruby/2.0.0/bin:/usr/local/bin:/usr/bin:/bin
I found the solution here: https://devcenter.heroku.com/articles/ruby-versions
Adding the path won't necessarily help as it's looking for a 'bin' directory under your project directory, which is standard now under rails 4. Go see the answers under "bin/rails: No such file or directory" w/ Ruby 2 & Rails 4 on Heroku for more information.

Heroku, ror, no dynos

I have a ruby on rails app on Heroku, its been there for while with one dyno ( kinda experminetation project ).
Today I changed some text entries in one of the files under views. started the server locally and got it ti run, did a push to heroku and all of the sudden after that push Heroku stopped working. Running heroku logs I get this
013-06-15T22:09:30.344294+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/" dyno= connect= service= status=503 bytes=
So I login to heroku to see whats the matter, I notice I don't have any dynos available for this app. After some googling I got some results to add a dyno using this command
heroku ps:scale web=1
Scaling web dynos... failed
! No such type as web.
But the message coming back was that no such type as web!!
What did I do wrong? All the edit I did was some text ( its my blog ).
PS :
I don't have a procfile, and I checked on my git history and I never did have a Procfile, and this has worked before.
ok so I found the answer,
Basically I had to add a Procfile ( still don't know why because my app was working before without one ), and in that procfile I do
web: bundle exec unicorn -p $PORT -E $RACK_ENV
Heroku recommends this approach for production apps.
link to heroku article
https://devcenter.heroku.com/articles/rails3#deploy-your-application-to-heroku

Heroku cedar doesn't upgrade to ruby-1.9.3

Trying to port Heroku cedar from Ruby 1.9.2 to Ruby 1.9.3 fails :
2012-07-25T22:09:48+00:00 heroku[slugc]: Slug compilation started
2012-07-25T22:11:23+00:00 heroku[api]: Deploy abdaf18 by luca.soave#gmail.com
2012-07-25T22:11:23+00:00 heroku[api]: Release v244 created by luca.soave#gmail.com
2012-07-25T22:11:23+00:00 heroku[web.1]: State changed from up to starting
2012-07-25T22:11:24+00:00 heroku[deployhooks]: Notified New Relic about the deploy
2012-07-25T22:11:24+00:00 heroku[slugc]: Slug compilation finished
2012-07-25T22:11:26+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2012-07-25T22:11:27+00:00 app[web.1]: Exiting
2012-07-25T22:11:28+00:00 heroku[web.1]: Process exited with status 0
2012-07-25T22:11:28+00:00 heroku[web.1]: Starting process with command `bundle exec rails server thin -p 12558`
2012-07-25T22:11:29+00:00 app[web.1]: Your Ruby version is 1.9.2, but your Gemfile specified 1.9.3
2012-07-25T22:11:30+00:00 heroku[web.1]: Process exited with status 18
2012-07-25T22:11:30+00:00 heroku[web.1]: State changed from starting to crashed
2012-07-25T22:11:30+00:00 heroku[web.1]: State changed from crashed to starting
2012-07-25T22:11:36+00:00 heroku[web.1]: Starting process with command `bundle exec rails server thin -p 36407`
2012-07-25T22:11:37+00:00 app[web.1]: Your Ruby version is 1.9.2, but your Gemfile specified 1.9.3
2012-07-25T22:11:39+00:00 heroku[web.1]: Process exited with status 18
2012-07-25T22:11:39+00:00 heroku[web.1]: State changed from starting to crashed
2012-07-25T22:11:40+00:00 heroku[router]: Error H10 (App crashed) -> GET gitwatcher.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-25T22:11:41+00:00 heroku[router]: Error H10 (App crashed) -> GET gitwatcher.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-07-25T22:11:41+00:00 heroku[router]: Error H10 (App crashed) -> GET gitwatcher.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
UPDATE
I followed Heroku docs by having
ruby '1.9.3'
into my Gemfile and bundler --pre :
lsoave#ubuntu:~/rails/github/gitwatcher$ gem list bundler
*** LOCAL GEMS ***
bundler (1.2.0.pre.1, 1.1.4)
lsoave#ubuntu:~/rails/github/gitwatcher$
UPDATE
I follwed heroku suggestion: If absent or not the first entry, add bin: to the config with heroku config:add. but it doesn't work :
lsoave#ubuntu:~/rails/github/gitwatcher$ heroku config -s | grep PATH
GEM_PATH=vendor/bundle/ruby/1.9.1
PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
lsoave#ubuntu:~/rails/github/gitwatcher$
... this is strange because running ruby -v in the console give back the corret version :
lsoave#ubuntu:~/rails/github/gitwatcher$ heroku run:detached "ruby -v"
Running `ruby -v` detached... up, run.1
Use `heroku logs -p run.1` to view the output.
lsoave#ubuntu:~/rails/github/gitwatcher$ heroku logs -p run.1
2012-07-25T22:51:57+00:00 heroku[run.1]: Starting process with command `ruby -v`
2012-07-25T22:51:57+00:00 app[run.1]: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
2012-07-25T22:51:57+00:00 heroku[run.1]: State changed from starting to complete
2012-07-25T22:51:58+00:00 heroku[run.1]: Process exited with status 0
lsoave#ubuntu:~/rails/github/gitwatcher$
UPDATE
... moreover I did :
heroku config:add RUBY_VERSION=ruby-1.9.3-p194
heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
recompile ( change + git commit + git push heroku +master )
but nothing, it crash after recompilation this way :
2012-07-25T23:18:47+00:00 heroku[router]: Error H10 (App crashed) -> GET gitwatcher.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-25T23:18:47+00:00 heroku[nginx]: 93.34.152.105 - - [25/Jul/2012:23:18:47 +0000] "GET / HTTP/1.1" 503 601 "-" "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1" gitwatcher.com
UPDATE
Opened Heroku Call Request #58410
It was not a ruby version problem, infact I notice the following error during heroku compilation, even if it didn't block the deploy and the push completed without other problems :
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
Invalid CSS after "...nd-image:url(""": expected ")", was "/assets/twitter..."
(in /tmp/build_19ypab978ku1z/app/assets/stylesheets/application.css)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
then looking better into heroku logs, I also see this one :
psych/syntax_error.rb:5:in 'initialize': wrong number of arguments (1 for 6) (ArgumentError)
and googling it turns out something similar, I tried and it works !
2012-07-25T22:11:29+00:00 app[web.1]: Your Ruby version is 1.9.2, but your Gemfile specified 1.9.3
https://devcenter.heroku.com/articles/ruby-versions

Resources