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
Related
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
I have the logs and one error at the bottom I have tried rake db migrate. which didn't work either.
2017-01-28T17:08:44.257358+00:00 heroku[router]: at=info method=POST path="/sign_in" host=www.pointsonpaper.com request_id=17ca7be4-c859-47ba-b680-fc1d13a2aaaf fwd="104.57.187.118" dyno=web.1 connect=0ms service=690ms status=500 bytes=906
eo you have a rails app deployed on heroku? If so,
well on heroku you should run
heroku run rake db:migrate
However, to be more precise you should show your logs.
Run heroku logs in your terminal and post the actual error here.
I am using rails 4.1.8, ruby 2.1.1, heroku toolbelt 3.17.1
In rails I've written a method that returns random rows from the db (postgres) that meet certain parameters:
elsif f == 'random'
(Piece.all - current_user.followed_pieces - current_user.pieces).sample(10)
This method functions properly in development. In deployment, when this method is triggered Heroku returns a 500 internal server error with altogether unhelpful logs:
2014-12-08T18:28:22.628654+00:00 heroku[router]: at=info method=GET path="/api/pieces?filter=random"
host=sheltered-castle-3185.herokuapp.com request_id=88107b5e-45f6-4d44-8c3c-9b91c18411f2
fwd="67.174.254.226" dyno=web.1 connect=6ms service=90ms status=500 bytes=330
I've migrated the database and in production.rb my config.log_level = :debug, no other pages or methods on the webapp trigger a server error.
I am using devise gem with rails for authentication, my application is running fine locally but the devise views are not accessible when deploying on heroku.
Checking the log gives me following error:
←[app[web.1]:←[0m Processing by Devise::SessionsController#new as HTML
←[app[web.1]:←[0m Processing by Devise::SessionsController#new as HTML
←[app[web.1]:←[0m Completed 500 Internal Server Error in 4ms
←[heroku[router]:←[0m at=info method=GET path=/favicon.ico host=clickive.herokuapp.com request_id=739b163c-d2b3-493c-8cfa-ffabc454f468 fwd="148.88.244.110" dyno=web.1 connect=1ms service=5ms status=200 by tes=228
Can anyone help please...
i had similar issue make sure you add to your Gemfile:
gem 'bcrypt-ruby'
and then hit bundle install and push to heroku once more.
I checked the log and found that i had forgot to run AddUsernametoUsers migration on the production database.
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.