Rails application getting 500 error page on production - ruby-on-rails

I'm migrating a working Rails 3 application from server to another type of service. Firstly I had issues with static files (e.g. application.css, application.js) not being rendered (404 status). I resolved that issue turning the config.assets.enabled to true.
Now I'm having the problem of error 500 no matter where I go in the application. I assume it's an asset problem. I don't get an error in log/production. Only something as follow:
Started GET "/" for 187.39.38.147 at 2016-06-14 12:33:05 +0000
Processing by BooksController#index as HTML
Rendered myapp/layouts/500.html (0.7ms)
Completed 404 Not Found in 16ms (Views: 10.0ms | ActiveRecord: 1.9ms)
I have no idea of how to find out what's wrong to fix that.
What can I do to find out what's wrong ?

Related

Rails 500 error in log, 404 page returned and no error description

I have an application running on NGINX/Passenger in production environment. Most of the pages render fine, but some do not. The server returns the static 404 error page, but when checking the production log, the following is appended:
Started GET "/upload" for 92.111.174.132 at 2015-11-26 14:07:50 +0000
Processing by Upload::StaticController#index as HTML
Rendered upload/static/index.html.erb within layouts/upload (1.1ms)
Completed 500 Internal Server Error in 8.0ms
Note that there are no error messages or backtraces; this is really all there is. I've checked NGINX's error log and it does not report an error. I really don't know where to go from here.

Rails 4.2 - after upgrade, pages never load in browser (or take really long) despite server activity

I am in the process of upgrading our app from Rails 3.2 to 4.2. One of the problems I've run into is that even static pages don't seem to be loading in the browser for some reason, despite browser activity. Example: I go to localhost:3000/pricing and get this in the server:
Started GET "/pricing" for 127.0.0.1 at 2015-01-16 15:44:59 -0500
Processing by PagesController#show as HTML
Parameters: {"id"=>"pricing"}
Rendered pages/pricing.html.haml within layouts/static (9.1ms)
Rendered layouts/_head.html.haml (64.4ms)
Rendered layouts/_navbar.html.haml (4.5ms)
Rendered layouts/_alerts.html.haml (1.0ms)
Rendered pages/_nav.html.haml (5.3ms)
Rendered shared/_social_links.html.haml (1.1ms)
Rendered layouts/_footer.html.haml (6.6ms)
Completed 200 OK in 130ms (Views: 123.8ms | ActiveRecord: 0.0ms)
However, the page in the browser itself is just white, the progress circle in the tab is spinning, and nothing is showing up.
Anyone know what might be causing this?
UPDATE
The page loads normally when I set config.cache_classes = true in development.rb. But this setting is normally false in development and wasn't doing this before I upgraded.
The problem was being caused by a gem called "rails-dev-tweaks" that is no longer needed in Rails 4. Removing that gem fixed the problem.
Your request on the server side seem to have completed in 130ms so this could be a problem with your client browser. Did you try using a different browser or look at the browser console of any javacript errors?

'Add new page' on production doesn't work

The app works fine in local , but when i open the refinery app in production - home page is missing . I shifted my migration but still no help . Surprisingly , the contact , blog and forem page show up minus the css . All the errors i get to see are a banner written - Sorry , something must have gone wrong or you must have mistyped the address .
Also i had included bootstrap and bootstrap responsive to my project , all the css files are getting compiled .
Following error i took out from the terminal
Started GET "/assets/refinery/application.css.scss" for 127.0.0.1 at 2013-10-21 14:41:41 +0530
Served asset /refinery/application.css.scss - 404 Not Found (25ms)
Processing by Refinery::PagesController#show as
Parameters: {"path"=>"assets/refinery/application.css", "locale"=>:en}
Rendered public/404.html (0.1ms)
Filter chain halted as :find_page rendered or redirected
Completed 404 Not Found in 29ms (Views: 9.6ms | ActiveRecord: 10.1ms)
Started GET "/assets/refinery/about.css.scss" for 127.0.0.1 at 2013-10-21 14:41:41 +0530
Served asset /refinery/about.css.scss - 404 Not Found (21ms)
Processing by Refinery::PagesController#show as
Parameters: {"path"=>"assets/refinery/about.css", "locale"=>:en}
Rendered public/404.html (0.1ms)
Filter chain halted as :find_page rendered or redirected
Completed 404 Not Found in 31ms (Views: 16.6ms | ActiveRecord: 1.8ms)
Please help , thanx in advance :)
The problem was coming due to bootstrap ,
Had to rename my application.css -> application.css.scss
Also did the #imports bootstrap
Make sure you have require 'bootstrap' in config

What is the difference in "Processing by Contoller#method as */*" and "Processing by BillsController#show as HTML"

All of my rails 3.2.2 ActiveRecord methods are being executed twice. I noticed that each execution is being processed differently, see the examples I grabbed from the console below...
Started GET "/api/bills/Jeremy%20Fox" for 127.0.0.1 at 2012-03-20 23:16:43 -0400
Processing by BillsController#show as HTML
Parameters: {"username"=>"Jeremy Fox"}
BillsForUsers Load (2.4ms) SELECT "bills_for_users".* FROM "bills_for_users" WHERE "bills_for_users"."billusername" = 'Jeremy Fox'
Completed 200 OK in 47ms (Views: 11.2ms | ActiveRecord: 2.4ms)
Started GET "/api/bills/Jeremy%20Fox" for 127.0.0.1 at 2012-03-20 23:16:44 -0400
Processing by BillsController#show as */*
Parameters: {"username"=>"Jeremy Fox"}
BillsForUsers Load (1.1ms) SELECT "bills_for_users".* FROM "bills_for_users" WHERE "bills_for_users"."billusername" = 'Jeremy Fox'
Completed 200 OK in 33ms (Views: 28.1ms | ActiveRecord: 1.1ms)
Can anyone explain to me why all of my ActiveRecord methods are being executed twice and/or what the difference is between Processing by BillsController#show as HTML and Processing by BillsController#show as */*?
Thanks.
It turns out the problem was actually the JSONView Chrome extension. As it states in the options menu...
Use safe method to parse HTTP response (*)
(*) : safe method forces the browser to send an extra HTTP request to get the raw HTTP content.
After spending days trying to figure out what I was doing wrong in my code, it was actually just chrome!
Hope no one else runs into this stupid issue.
-Jeremy
I've been grappling with this same issue. The HTML Validator Chrome extension is also guilty (with none of the fine print.)
In my case, I'm calling a ModestModel-backed search request, so the first hit (and rendering) was succeeding, followed by a phantom 500 as my non-DB search model was out of scope and nil on the second request.
Thanks, Jeremy!

Rails 3 not writing 500 status to log

I'm running a Rails 3.0.7 app with nginx and Passenger. I have a custom 500 page that is properly displayed when the app encounters an 500 internal error, however the actual '500' status is not being output to the logs.
I'd like to be able to periodically grep the logs to find 500 errors, but I can't seem to figure out why the actual status is not being rendered. I've even looked through the Rails code, and everything looks fine. All other status codes are successfully logged.
Here is an error-free 200 response:
Completed 200 OK in 1265ms (Views: 1262.4ms | ActiveRecord: 69.6ms | Sphinx: 0.0ms)
Here is a 500 response:
Completed in 500ms
It appears that something is supposed to be there, but is not, so spaces are output instead.
Looks like this has been resolved in Rails master, but is not in the gem for 3.0.7 yet.
https://github.com/rails/rails/commit/7927fc2ff77543a0ab151ac1cb3d60318e2dfa68

Resources