-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error with rack-mount and rails 4.2.4 #1151
Comments
We've discussed rack-mount in #1072, nothing really came out of it, would love to replace it. Grape did change the response to be a Rack::Response, and this is not supposed to happen, do you have a vanilla project in which we can see this? |
@dblock yeah, just checkout https://github.com/noosfero/noosfero.git, branch
We were using grape 0.13.0, is the change to Rack::Response there? |
This was in 0.12.0, https://github.com/ruby-grape/grape/blob/master/UPGRADING.md#upgrading-to--0120, every time an issue like this has come up it seemed like the problem was in rack-mount but it wasn't. |
@dblock the strange thing is that this is single failing test, among many others. I don't see any grape's middleware used. |
@dblock an exception is happening! and as it happens it crashes the rack-mount! Do you know why? |
Lets reopen this, I'll take a look when I have a few. |
@dblock it didn't happen on rails 3.2, so maybe it is a new way rails4.2/rack1.6 is issuing exceptions |
This test passes on my machine, I have updated Grape to 0.13. How do I reproduce the problem?
|
@dblock we fixed the exception that was happening on the AR model. Maybe we can make a test to reproduce this inside grape. |
@dblock maybe a simple |
Do you have a commit or a way to put back the exception? |
The problem is this: rescue_from :all do |e|
logger.error e
end If you rescue an error you're not supposed to swallow it. It's clearly not well documented, but what's happening here is that Help me edit the README to explain this? A simple fix is rescue_from :all This causes the following response:
If you want to log, you want something like this: rescue_from :all do |e|
logger....
error! e.message, 500
end You definitely want to fix this in your codebase or unexpected errors will never be returned to the API clients. Write a test that causes an exception and makes sure the error is valid JSON for example. |
thanks a lot @dblock, I'll test this. on noosfero/noosfero@190f639 the test should still FAIL |
See my explanation above. LMK if you need help. |
…ll error./script/quick-start Closes #1151. [ci-skip]
@dblock nice, just applied your suggestion on error handling: noosfero/noosfero@8bc107b Looking to the README all its examples show this. We really missed that, gonna contact the api developers. |
Seems the problem is still present when using
|
@ka8725 If you can have a very simple repro that would be helpful. |
This makes sense. I opened #1174. I'd like some note in UPGRADING about this error and known issues with middleware such as Warden. Please feel free to PR anything that would be useful for the next person. |
The following error happens only with rails 4.2.4 (and rack 1.6) and not on rails 3.2.22 (and rack 1.4):
The error happened because
rack-mount
is expecting the result of rack call to be an array, but it is a hash (filerack-mount-0.8.3/lib/rack/mount/route_set.rb
):It seems that
rack-mount
is unmaintained for a long time (even the repo was deleted). Have you considered to not depend on it anymore?cc @diguliu @terceiro
The text was updated successfully, but these errors were encountered: