I just deployed an app to Heroku, its URL is: http://msitproject.heroku.com
When I uploaded the app it was working fine but then I added another view named developer.
This link is working perfectly in my localhost but when I click on Developer link in the navbar on Heroku I get redirected to the error 500 page. I can't figure out that why is this happening.
I used the code
git push heroku master
followed by:
heroku run rake db:migrate
The link of my github repo is: https://github.com/rohitbegani/msitproject
Here are my heroku logs:
2014-02-05T18:26:29.028106+00:00 heroku[router]: at=info method=GET path=/user_friendships.json host=msitproject.herokuapp.com request_id=5e6692bd-8d4d-40dc-863b-2ec608bebe70 fwd="122.161.19.141" dyno=web.1 connect=2ms service=21ms status=401 bytes=61
2014-02-05T18:26:31.981378+00:00 app[web.1]: Started GET "/developer" for 122.161.19.141 at 2014-02-05 18:26:31 +0000
2014-02-05T18:26:31.985163+00:00 app[web.1]: Processing by DeveloperController#show as HTML
2014-02-05T18:26:32.022137+00:00 app[web.1]: Rendered developer/show.html.erb within layouts/application (34.6ms)
2014-02-05T18:26:32.022137+00:00 app[web.1]: Completed 500 Internal Server Error in 37ms
2014-02-05T18:26:32.024083+00:00 app[web.1]:
2014-02-05T18:26:32.024083+00:00 app[web.1]: ActionView::Template::Error (rohitbegani.jpg isn't precompiled):
2014-02-05T18:26:32.024083+00:00 app[web.1]: 1: <div class="dev-image offset5"><%= image_tag 'rohitbegani.jpg' %></div>
2014-02-05T18:26:32.024083+00:00 app[web.1]: 2: <h1 class="dev-text">Rohit Begani</h1>
2014-02-05T18:26:32.024083+00:00 app[web.1]: app/views/developer/show.html.erb:1:in ``_app_views_developer_show_html_erb__2217822362271118091_28442460'
2014-02-05T18:26:32.024083+00:00 app[web.1]: 3: <h3 class="dev-text">Developer, Designer and an avid football fan</h3>
2014-02-05T18:26:32.024083+00:00 app[web.1]:
2014-02-05T18:26:32.024083+00:00 app[web.1]: 4: <p class="dev-text">Hi I am a developer and a designer from New Delhi, India. Some of the languages I code in are Ruby, RoR, HTML, CSS(3).<br> I am a strong believer of open source and most of my projects are available publicly.<br>Other than coding I love to watch football and root for the gunners. Oh yeah I love bikes.<br> I am the co-founder of ObtuseOrange, a design comapny based in New Delhi, India</p>
2014-02-05T18:26:32.024083+00:00 app[web.1]:
2014-02-05T18:26:32.028671+00:00 heroku[router]: at=info method=GET path=/developer host=msitproject.herokuapp.com request_id=fc9de369-7b14-49bf-ae60-3cec6082e2a8 fwd="122.161.19.141" dyno=web.1 connect=4ms service=48ms status=500 bytes=64
try to precompile your assets locally and then push it again on heroku
$ RAILS_ENV=production bundle exec rake assets:precompile
after compilation don't forget to do
$git add public/assets
$git commit -m "vendor compiled assets"
in your master branch, this way u will be pushing your latest master with compiled assests,
Related
I get this error on my Rails 5.1.1 app that I just hosted on Heroku
2017-06-22T05:15:05.148829+00:00 app[web.1]: F, [2017-06-22T05:15:05.148717 #4] FATAL -- : [ef509b29-8637-41b3-8224-4423dbf2b2ed]
2017-06-22T05:15:05.148948+00:00 app[web.1]: F, [2017-06-22T05:15:05.148883 #4] FATAL -- : [ef509b29-8637-41b3-8224-4423dbf2b2ed] ActionView::Template::Error (Can't find sales.js in /app/public/packs/manifest.json. Is webpack still compiling?):
2017-06-22T05:15:05.149203+00:00 app[web.1]: F, [2017-06-22T05:15:05.149103 #4] FATAL -- : [ef509b29-8637-41b3-8224-4423dbf2b2ed] 1: %div#sale
2017-06-22T05:15:05.149206+00:00 app[web.1]: [ef509b29-8637-41b3-8224-4423dbf2b2ed] 2: = javascript_pack_tag 'sales'
2017-06-22T05:15:05.149297+00:00 app[web.1]: F, [2017-06-22T05:15:05.149231 #4] FATAL -- : [ef509b29-8637-41b3-8224-4423dbf2b2ed]
2017-06-22T05:15:05.149398+00:00 app[web.1]: F, [2017-06-22T05:15:05.149328 #4] FATAL -- : [ef509b29-8637-41b3-8224-4423dbf2b2ed] app/views/sales/new.html.haml:2:in `_app_views_sales_new_html_haml___2340659139987297731_36903000'
2017-06-22T05:15:07.004434+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=planetlauncher.herokuapp.com request_id=8bca0b65-0d4a-494f-88c7-a4b31c2ff6dc fwd="202.163.79.6" dyno=web.1 connect=1ms service=2ms status=200 bytes=143 protocol=https
There's only one route
Rails.application.routes.draw do
root 'sales#new'
resources :sales
end
My app has a single view:
# sales/new.html.haml
%div#sale
= javascript_pack_tag 'sales'
The view is replaced by a React component at app/javascript/packs/sales.jsx on load.
The app works flawlessly in development, I ran rails assets:precompile before pushing, and deployed to Heroku.
Edit: Full source is available here
According this #gauravtiwari from this github thread:
So either - remove [ the /public/packs line] from gitignore or don't precompile locally and
let heroku do it i.e. delete the public/assets folder
BTW there is one gotcha - webpacker:compile depends on assets:precompile so best is to leave it to Heroku and don't compile assets locally.
So following his advice, I git revert my commits that precompiled assets locally and everything starte working.
You can either do what I did or run rm -rf /public/assets to get rid of your precompiled assets.
I suppose you can go one step further and add /public/assets to your .gitignore to ensure no one accidentally compiles assets in the future.
I'm leaving this question up because I got this weirdness from a vanilla rails app, someone else is bound to run into and upvote my answer since it helped them ;)
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 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
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.
I've been working through Hartl's excellent RoR (3.2) tutorial (and deploying to Heroku throughout) and have become stumped why the Heroku version is no longer mirroring the behavior of the locally hosted app.
I'm at the end of section 7.4.4: http://ruby.railstutorial.org/chapters/sign-up?version=3.2#top
My locally hosted app passes all tests and is able to both create a new user and give appropriate error messages when user/email/password input is incorrect or out of spec. On the Heroku deployment of the app I am getting neither success in creating a user nor correct error pages as there seems to be something wrong with the password digest function in that version. I am taken to a generic Heroku "We're sorry, but something went wrong" page.
The "heroku logs" command gives me:
Started POST "/users" for 97.81.107.108 at 2012-04-10 19:41:17 +0000
2012-04-10T19:41:17+00:00 app[web.1]: Processing by UsersController#create as HTML
2012-04-10T19:41:17+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"0jnDCpFnVq9fd/v1lgLNB7g0wHuXGi5bocTD3SINRzc=", "user"=>{"name"=>"helloq", "email"=>"this#this.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create my account"}
2012-04-10T19:41:17+00:00 app[web.1]:
2012-04-10T19:41:17+00:00 app[web.1]: app/controllers/users_controller.rb:12:increate'
2012-04-10T19:41:17+00:00 app[web.1]:
2012-04-10T19:41:17+00:00 app[web.1]: NoMethodError (undefined method password_digest=' for #<User:0x0000000229e9e0>):
2012-04-10T19:41:17+00:00 app[web.1]:
2012-04-10T19:41:17+00:00 heroku[router]: POST simple-sword-1851.herokuapp.com/users dyno=web.1 queue=0 wait=0ms service=128ms status=500 bytes=643
2012-04-10T19:41:17+00:00 app[web.1]: Completed 500 Internal Server Error in 104ms
2012-04-10T19:41:17+00:00 app[web.1]: app/controllers/users_controller.rb:12:innew'
Why would I get a NoMethodError when the password_digest method is functioning properly on the local deployment? I've checked with git that my local version and the remote heroku version are the same, and I've made sure to migrate the database and restart the app.
Thanks for any suggestions!
I am working through the tutorial as well and just about done. I want to follow up on Matthias's comment. Looking at chapter 7, he doesn't tell you how to reset the DB on Heroku yet. If you want to completely clear the DB and re-run the migrations do this:
heroku pg:reset SHARED_DATABASE --confirm simple-sword-1851
heroku run rake db:migrate
I had some problems occasionally when I messed up something in the migration.