Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"We're sorry, but something went wrong." in development mode #11063

Closed
istana opened this issue Jun 23, 2013 · 32 comments
Closed

"We're sorry, but something went wrong." in development mode #11063

istana opened this issue Jun 23, 2013 · 32 comments

Comments

@istana
Copy link

istana commented Jun 23, 2013

Rails throws

We're sorry, but something went wrong.
If you are the application owner check the logs for more information.

But in development mode (log level is debug, all_requests_considered_local) it should display backtrace with informations.

Problem occurs when render is called fom controller or view and view (or partial) is misformatted (tested on slim, haml and erb) or somehow throws error. Does this with RC2 and master as well.

Whole log for request look like this:

Started GET "/admin/" for 127.0.0.1 at 2013-06-23 16:22:18 +0200
  Vega::Setting Load (0.1ms)  SELECT "vega_settings".* FROM "vega_settings" WHERE "vega_settings"."type" = 'global' AND "vega_settings"."name" = 'title' LIMIT 1
  Vega::Setting Load (0.1ms)  SELECT "vega_settings".* FROM "vega_settings" WHERE "vega_settings"."type" = 'global' AND "vega_settings"."name" = 'language' LIMIT 1
Processing by Vega::Admin::DashboardController#index as HTML
  Rendered /home/hrdina/liaheň/vega/app/views/vega/admin/dashboard/index.html.erb within layouts/vega/admin (18.2ms)
  Rendered /home/hrdina/liaheň/vega/app/views/vega/general/_admin_menu.html.haml (1.1ms)
Completed 500 Internal Server Error in 61ms
@senny
Copy link
Member

senny commented Jun 23, 2013

@istana can you please upload an isolated sample application to GitHub to reproduce the issue?

@istana
Copy link
Author

istana commented Jun 23, 2013

Finally I know why.... problem is 'ň' in the path. I tried few non-acsii characters (ľ, á) and none worked. Also tried every combination of ruby 1.9.3, 2.0.0, rvm and rbenv.

I don't know, if this is issue, but I thought Ruby (or Rails?) is UTF-8 compatible and behaviour is really weird.

See for yourself: http://i.imgur.com/sg1chbG.png

@senny what do you think?

@steveklabnik
Copy link
Member

Make sure that your browser is properly escaping the character. Don't trust the URI bar, check the logs.

Also, http://stackoverflow.com/questions/2504564/can-http-uris-have-non-ascii-characters

I'm pretty sure this isn't a bug.

@istana
Copy link
Author

istana commented Jun 24, 2013

Problem is related to filesystem path, not URIs. If application is located in /home/user/čosi/application it shows logs like in production mode while in development mode. If I rename it to /home/user/cosi/application it works just fine.

@istana
Copy link
Author

istana commented Jun 24, 2013

I have created demo app: https://github.com/istana/test_err500

@steveklabnik
Copy link
Member

Ahhh. We have a ticket related to filepaths having a [ in it somewhere...

@pixeltrix
Copy link
Contributor

@steveklabnik #6010 but I think this is different - looks like it may be an encoding issue rather than a glob escaping issue.

@senny
Copy link
Member

senny commented Jun 25, 2013

I'll take a look and report back.

@senny
Copy link
Member

senny commented Jun 25, 2013

I can confirm this is an encoding problem. It's related to the backtrace generated when you have non-ascii characters in your file paths. Here is a simplified reproduction: https://gist.github.com/senny/5857653

@cristianferrarig
Copy link

I had the same problem but only on some routes in the app.
In my case, this was because it had special characters in the respective controllers.
To fix this, I add at the beginning of each controller the next line
# encoding: utf-8

Sorry if this is not the best solution, but it worked for me. (for now)

@printercu
Copy link
Contributor

@senny, I have the same issue with slim templates and don't have any special characters in file path. Haml's SyntaxError and erb's ActionView::Template::Error are rendered as usual. But with slim's ActionView::Template::Error I get We're sorry, but something went wrong..

@Hussein1147
Copy link

hello I am having a somewhat similar issue in production mode, this is the same log i get

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.

My application works perfectly in development mode.

@Hussein1147
Copy link

in the server log there is this error
ActionController::RoutingError (No route matches [GET] "/"), but here is the whole log if that helps:

[blog]$ rails s -e production
=> Booting WEBrick
=> Rails 4.0.4 application starting in production on http://0.0.0.0:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
[2014-03-23 03:41:43] INFO WEBrick 1.3.1
[2014-03-23 03:41:43] INFO ruby 2.1.0 (2013-12-25) [x86_64-darwin12.0]
[2014-03-23 03:41:43] INFO WEBrick::HTTPServer#start: pid=20459 port=3000
I, [2014-03-23T03:41:46.121007 #20459] INFO -- : Started GET "/" for 127.0.0.1 at 2014-03-23 03:41:46 -0400
F, [2014-03-23T03:41:46.237088 #20459] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/"):
actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' actionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:incall'
railties (4.0.4) lib/rails/rack/logger.rb:38:in call_app' railties (4.0.4) lib/rails/rack/logger.rb:20:inblock in call'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in block in tagged' activesupport (4.0.4) lib/active_support/tagged_logging.rb:26:intagged'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in tagged' railties (4.0.4) lib/rails/rack/logger.rb:20:incall'
actionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in call' rack (1.5.2) lib/rack/methodoverride.rb:21:incall'
rack (1.5.2) lib/rack/runtime.rb:17:in call' activesupport (4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:incall'
rack (1.5.2) lib/rack/sendfile.rb:112:in call' railties (4.0.4) lib/rails/engine.rb:511:incall'
railties (4.0.4) lib/rails/application.rb:97:in call' rack (1.5.2) lib/rack/lock.rb:17:incall'
rack (1.5.2) lib/rack/content_length.rb:14:in call' rack (1.5.2) lib/rack/handler/webrick.rb:60:inservice'
/Users/djibrilkeita/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in service' /Users/djibrilkeita/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:inrun'
/Users/djibrilkeita/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'

@pixeltrix
Copy link
Contributor

@Hussein1147 what do you get in development mode at the root url? The welcome to rails page?

@Hussein1147
Copy link

yes, in development mode i get the rails welcome page at the root directory.

@pixeltrix
Copy link
Contributor

@Hussein1147 that's the reason you see the error in production - that welcome page is only enabled in development mode to help you get started. You really should be adding a root url page of your own before deploying your website to production.

@Hussein1147
Copy link

how would you go about adding a root url page?

@Hussein1147
Copy link

@pixeltrix so i have added a root url, and it shows the root url but whenever i run rails s -e production,

i throws:
PG::ConnectionBad (FATAL: database "demo_app2_live" does not exist
):
my database.yml looks like this:
development:
adapter: postgresql
encoding: unicode
database: demo_app2_development
pool: 5
username: djibrilkeita
password:
test:
adapter: postgresql
encoding: unicode
database: demo_app2_test
pool: 5
username: djibrilkeita
password:
production:
adapter: postgresql
encoding: unicode
database: demo_app2_live
pool: 5
username: djibrilkeita
password:

@Hussein1147
Copy link

problem solved, thank you for the help

@robin850
Copy link
Member

I think we can close this one. Thanks for reporting anyway @Hussein1147! :-)

@jheathco
Copy link

jheathco commented Apr 2, 2014

Can anyone advise to printercu's comment above? I'm having this issue as well.

@Hussein1147
Copy link

you should reopen an issue

@Hussein1147
Copy link

you probably need to and a root directory in you routes file. it goes something like this:
root 'welcome#index'.

@ArtoriusXIII
Copy link

It is not big deal you have to run:
(name of ur project)(master)$ heroku run rake db:migrate
it will resolve your issue

@Joshhortt
Copy link

Hey everyone. I had the same problem and Yes ArtoriusXIII you are right. Just run the following command in your terminal, icloud9 terminal whatsoever:
(name of your project)(master)$ heroku run rake db:migrate
and hit enter. Refresh your app url and it should work perfectly well again.

@amadeuspagel
Copy link

I have the same problem (am in development mode but get "sorry something went wrong").

@pixeltrix
Copy link
Contributor

@amadeuspagel if you believe you've found a bug in Rails then please open a new issue with details on how to reproduce it. However most people on this issue had a misconfigured application so please try to get help via stack overflow, irc, etc. first as it's likely that's your problem too. This issue tracker is purely for bugs and development (not discussion) of new features - thanks.

@faizaankhan
Copy link

Same issue, no configuration problem found !

@istana
Copy link
Author

istana commented Jun 1, 2018

The original issue should be fixed for years. @faizaankhan could you please verify if the problem is with non-ascii characters in filepaths or something else?

@faizaankhan
Copy link

The file paths are all okay, I had a complete check. I missed something during rails 5.2 update perhaps.

@cancerberoSgx
Copy link

@Hussein1147

I can verify that, if the the .erb files contains non ascii characters in a scriptlet (see below),rails server fails like mentioned in this issue and as a developer I find myself blind since I have no logs or clue of what's going on. Just happened to me when copy&paste code from a tutorial page, and the quotes are non-ascii characters like this:

<%= form_with url:  /post”, scope: “post” do |form| %>
  <%= form.submit 'Play!', class: 'button' %>
<% end %>

notice in the first line “post” vs "post"

I think this is an important ugly issue probably simple to solve so I recommend this issue is re-open. Versions used:

rails -v
Rails 6.0.1
ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]

Do you think I should open a new issue to report this particular problem separately ?

@istana
Copy link
Author

istana commented Dec 20, 2019

@cancerberoSgx I'd say it's better to create a new issue so it can get some attention, and reference this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

15 participants