rails_api_logger icon indicating copy to clipboard operation
rails_api_logger copied to clipboard

If logging requests that include file uploads in form data, this generates an error by attempting to encode with UTF-8

Open Halloran opened this issue 2 years ago • 1 comments

Halloran avatar Apr 11 '23 00:04 Halloran

This issue should also be solved in version 0.7.0. Please let me know

coorasse avatar Mar 04 '24 10:03 coorasse

I still have the issue on versions 0.7.0 and 0.9.0. In request_log.rb, self.from_request(request, loggable: nil): body = JSON.parse(body) if body.present? The call to body.present? throw the error "Puma caught this error: invalid byte sequence in UTF-8 (ArgumentError)".

ldes-karibew avatar Nov 13 '24 22:11 ldes-karibew

If the body contains a file, I think it would be wise to anyway skip the recording with the option skip_request_body_regexp. This will allow you to skip the logging of bodies for such cases. I know this might not be the answer you were looking for, but as long as we don't face the same issue I cannot fix it. I am very keen in accepting a PR that fixes the problem.

coorasse avatar Nov 20 '24 14:11 coorasse