-
-
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
Invalid rack response. #1572
Comments
@dopykuh Could you provide minimal failing project as github repository? |
These 2 lines will produce my exception dab3c09#diff-e9e8424a5238d48301e313d8fe285697 |
I wouldn't be so sure that this is a grape bug. It looks like the response is a hash that is not being formatted into a string. Which content type is here? What is the response from the |
Request on v.18.0
Request on v.19.0
|
The issue could also been appeared earlier, but it looks like an grape bug. You only setup a default right now, but response_body shouldn't be served as hash or not? |
This is a little more complicated. In 0.19.0 we made the server return 204 on a DELETE, then in 0.19.1 we fixed #1550 to return 200 when there's no content. That's ultimately what's causing this, but it's not necessarily a bug. So what you need to find out is why isn't your JSON formatter invoked on a DELETE. Wrong content type? Is JSON not the default formatter? I would definitely try explicitly 0.19.1, then HEAD, then I would dig through the code - maybe you have a custom formatter or something else in the way? As a workaround you can probably add in |
Ok, i'll check this tomorrow. I also tested head and 019.1, but how is it possible that the formatters are completly skipped, it would be nice if a fallback will raise or log a warning or sth. else. I'll try to find out where it comes from, i am able to reproduce them within my environment. ;) |
I am just speculating from the top of my head. Build a simple repro, maybe even a spec. |
I am unable to reproduce it out of my app environments. Currently i don't know why... |
Hi @dopykuh … how did you achieve this behavior?
you make a DELETE request, but your response assumes, you made a POST request for further investigating, I suggest to rescue_from :all do |error|
require 'pry'; binding.pry
end to catch the errors and see what is really happened @dblock one minor correction, in 0.19.0 status 204 was introduced as default for delete requests with an empty body, in 0.19.1, it was completed, to return 200 if the response did have a body 😉 |
@LeFnord sorry, wrong output posted.
|
@LeFnord its also not possible to rescue there because the exception will be raised within puma response handler due to unformatted response. Grape possibly skips the formatters so the impact is only visible later. |
The exception doesn't occur by manually setting |
v0.19.0...v0.19.1#diff-e9e8424a5238d48301e313d8fe285697R133 It looks like the body isn't already detected here, but will be served later. So it returned a 204 with content, which will trigger the issue? |
You narrowed down the problem, 204 means no content, so you should not have content with a 204. Now find how this happens. |
@dblock I'll take a look at monday. Could you give some tips, or do you have any ideas where the issue possibly come from? I don't know anything about your framework structure and debugging large dsl's are not as easy. :D |
I don't think I have much more useful info to add ;( Let us know what you find! If you put a repro up obviously it would be helpful. |
I tried, but i am unable to reproduce them. Don't know why ... |
Fixed in #1579. |
Please see here puma/puma#1208
The text was updated successfully, but these errors were encountered: