Fix 400 errors not being logged in multipart middleware
In https://gitlab.com/gitlab-com/gl-infra/production/-/issues/5194, we saw that Workhorse was logging 400 errors, but we could not see an associated error in the API logs to explain why this was happening. According to https://github.com/rack/rack/blob/master/SPEC.rdoc#label-The+Body, Rack v2.1+ now requires: ``` The Body must respond to `each` and must only yield String values ``` Since the response returned returned a plain string, we would only see this mysterious error in the Puma stderr logs: ``` Read: #<NoMethodError: undefined method `each' for <String:0x1234> ``` Making things worse, Puma didn't display the backtrace, and this exception wasn't caught by Sentry because the exception was happening outside of the middleware chain. We fix this by wrapping the string in an array. Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/336609 Changelog: fixed
Showing
Please register or sign in to comment