'Exception: ActionDispatch::Http::MimeNegotiation::InvalidType
I have error report in Sentry. How can I fix it?
ActionDispatch::Http::MimeNegotiation::InvalidType
{#context['com.opensymphony.xwork2.dispatcher.httpservletresponse'].addheader('o0scxl85'" is not a valid MIME type
Most recent lines of logs are:
actionpack (6.1.4.1) lib/action_dispatch/http/mime_negotiation.rb in rescue in block in content_mime_type at line 31
actionpack (6.1.4.1) lib/action_dispatch/http/mime_negotiation.rb in block in content_mime_type at line 24
rack (2.2.3) lib/rack/request.rb in fetch at line 69 rack (2.2.3) lib/rack/request.rb in fetch_header at line 69
Solution 1:[1]
[It will be helpful if you post the version of rails & sentry.]
As per my knowledge, latest versions of sentry-ruby already ignore this exception. Please check the commit. So, upgrading the sentry-ruby should solve your problem. If you wan't to handle it yourself, you need to add a custom middleware that catches the exception and send the response.
Reference: https://github.com/rails/rails/pull/35604#issuecomment-835274505
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | benpickles |