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.
Related
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 writing my first ever ruby on rails app.
Locally its great, I can visit localhost:3000/ and get the default landing page, and I can visit /users to interact with a scaffold object called User.
I am using postgresql for my db and this again works locally.
I want to deploy this project to heroku. I make sure git is pushed to heroku, which it is, I also ran heroku addons:add heroku-postgresql:development and i also run heroku run rake db:migrate which completes with no output.
When I visit my applications URL I see nothing :https://whats-on-today.herokuapp.com/ Heroku logs shows a http 404:
2014-12-02T17:03:48.311284+00:00 heroku[router]: at=info method=GET path="/" host=whats-on-today.herokuapp.com request_id=fcb9cc27-e5eb-4760-bc30-8a72fe2f0bbc fwd="195.212.29.67" dyno=web.1 connect=1ms service=10ms status=404 bytes=1829
I am not sure why I can access the root url http://localhost:3000/ locally no problem, on deployment to heroku I see nothing? There is nothing much of use in the logs other than the 404. What is my deployed http path? Surely this should work if it works locally?
Can somebody please help?
You did not define a root route. Try something like this in routes.rb
root 'welcome#index'
(The page welcome/index needs to exist obviously).
Your application is deployed correctly as https://whats-on-today.herokuapp.com/users clearly shows.
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 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,