Debug status 500 Rails in production - ruby-on-rails

Ruby 2.2.0
Rails 4.1.4
I get a 500 status code, but the reason is not indicated in logs.
When I click on a link, it immediately renders page 500.
Production on Heroku.
How can I find out the cause of error?
Started GET "/en/500" for myIP at 2019-09-26 11:37:03 +0000
2019-09-26T11:37:04.013793+00:00 app[web.1]: Processing by SiteController#internal_server_error as HTML
In development mode, this error does not appear.
I tried config.log_level = :debug, :info, :ERROR and config.logger = Logger.new(STDOUT) but nothing changed.

Related

500 internal server error on heroku after adding image{(favicon) in my rails app assets

i'm running on Ruby 2.3.3 &
rails 5.1
i'm getting this from heroku logs =>
ActionView::Template::Error (The asset "favicon/favicon.ico" is not present in the asset pipeline.):
folder path (assets/images/favicon/favicon.ico)
code in my application header:
<%= favicon_link_tag 'favicon/favicon.ico' %>
It was working locally, but I got a 500 internal server error when I pushed it to heroku. i have run
rake assets:precompile
and it's still not working.

Rails 5 + Puma + Pow not working locally

I'm updating my rails app to 5.0.0.rc1 in a separate branch. App was already configured to run on puma 2.14, but I upgraded to puma 3.4.0 during the update process.
I ran rails update but kept my old puma config around because nothing changed except the plugins directive which I don't care about now.
Anyway, I cannot get my app to respond in development mode, but I deployed it a staging server to see if I could get better error logs and it actually works on staging.
Before, I could access my app locally using pow by visiting:
http://app.dev
Now, that doesn't work. Neither does:
bundle exec puma -C config/puma.rb config.ru
Nor does this:
bin/rails server puma
My logs just show something like this everytime:
Started GET "/" for 127.0.0.1 at 2016-05-27 09:11:39 -0400
Started GET "/" for 127.0.0.1 at 2016-05-27 09:11:44 -0400
Started GET "/" for 127.0.0.1 at 2016-05-27 09:11:47 -0400
Started GET "/" for 127.0.0.1 at 2016-05-27 09:11:50 -0400
They never make it to Rails for processing no matter how I attempt to start the server locally. And that's all the error info I get, too. Pow's logs are similarly useless.
Any ideas whats going on?
The emotional successor of pow(latest commit on the repo is from 6 November 2014) is puma-dev. According to their docs pow is a no-go for Rails 5. Maybe you should give it a go.

Rails server killed when requesting a preview

I am working on M.Hartl's rails tutorial and I opted out for using the cloud9 IDE instead of the local server in order to focus on learning rails and not worry about working on the server.
This is the crash error that I am getting:
thermobee:~/workspace/sample_app (filling-in-layout) $ rails s -b $IP -p $PORT
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-12-15 05:19:02] INFO WEBrick 1.3.1
[2015-12-15 05:19:02] INFO ruby 2.2.1 (2015-02-26) [x86_64-linux]
[2015-12-15 05:19:02] INFO WEBrick::HTTPServer#start: pid=14300 port=8080
Started GET "/" for 174.113.76.61 at 2015-12-15 05:19:25 +0000
Processing by StaticPagesController#home as HTML
Rendered static_pages/home.html.erb within layouts/application (192.2ms)
Killed
It kept happening throughout the day. I would add code and it would sometimes get stuck saving the file and sometimes it the server would get killed as I try to view the work I've done so far. Every time I would get stuck at a different point as I kept deleting the git branch I was working on.
I apologize for the long winded question, but I did not know how to formulate this properly as there has been a lot going on. I can provide any files that would help solve this and I can also give you read access to the IDE files as well.

running rails app in production mode is not displaying the production server logs in terminal. and showing the error something went wrong in browser

When i run the rails app in development mode,server logs are displaying in terminal properly. But when i run the app in production mode server is not displaying any server logs in terminal. and an error is displaying in the browser like "We're sorry, but something went wrong.".i am running the server with the following command.and i am using the thin server.
rails s -e production
this is the output i am getting in server mode when i start the server.and after this when i made any request no output is displaying.
prashant#prashant-pc:~/client_proj/template$ rails s -e production
=> Booting Thin
=> Rails 4.1.5 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
what might be issue i am not getting.
In production.rb you can add this option:
config.logger = Logger.new(STDOUT)
If you see this block in the production.rb
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
then you can simply set environment variable to any value with export before starting the rails server
$ export RAILS_LOG_TO_STDOUT=true
Setting the environment variables RAILS_ENV=production and RAILS_LOG_TO_STDOUT=true did the job for me (with Rails 7.0.4)

getting RoutingError after upgrade to Rails 4

I have an application on Heroku, and after I update to Rails 4.1.0 I'm seeing these RoutingErrors exception:
Started GET "/assets/Elusive-Icons-5997c1a6679785a96defc4f57a3f2ff5.svg" for 177.16.216.169 at 2014-04-12 21:56:41 +0000
2014-04-12T21:56:41.397071+00:00 app[web.1]:
2014-04-12T21:56:41.397071+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/Elusive-Icons-5997c1a6679785a96defc4f57a3f2ff5.svg"):
I installed rails_12factor and tried to put config.serve_static_assets = true on applicationl.rb but no effect. What am I missing?
As mentioned in the comments, you should input this into your cmd: rake assets:precompile RAILS_ENV=production -- this, coupled with deploying to Heroku, should solve the issue

Resources